2 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3 # RUN: %lld -lSystem -o %t %t.o
4 # RUN: llvm-objdump --no-print-imm-hex --section-headers --syms -d %t | FileCheck %s
6 # CHECK-LABEL: Sections:
7 # CHECK: __data {{[0-9a-z]+}} [[#%x, DATA_ADDR:]]
9 # CHECK-LABEL: SYMBOL TABLE:
10 # CHECK: [[#%x, F_ADDR:]] {{.*}} _f
12 # CHECK-LABEL: <_main>:
13 ## Test X86_64_RELOC_BRANCH
14 # CHECK: callq 0x[[#%x, F_ADDR]] <_f>
15 ## Test extern (symbol) X86_64_RELOC_SIGNED
16 # CHECK: leaq [[#%u, LOCAL_OFF:]](%rip), %rsi
17 # CHECK-NEXT: [[#%x, DATA_ADDR - LOCAL_OFF]]
18 ## Test non-extern (section) X86_64_RELOC_SIGNED
19 # CHECK: leaq [[#%u, PRIVATE_OFF:]](%rip), %rsi
20 # CHECK-NEXT: [[#%x, DATA_ADDR + 8 - PRIVATE_OFF]]
22 # RUN: llvm-objdump --section=__const --full-contents %t | FileCheck %s --check-prefix=NONPCREL
23 # NONPCREL: Contents of section __DATA_CONST,__const:
24 # NONPCREL-NEXT: 100001000 08200000 01000000 08200000 01000000
26 .section __TEXT,__text
29 callq _f
# X86_64_RELOC_BRANCH
34 leaq _local
(%rip
), %rsi
# Generates a X86_64_RELOC_SIGNED pcrel symbol relocation
35 leaq L_.private
(%rip
), %rsi
# Generates a X86_64_RELOC_SIGNED pcrel section relocation
36 movq L_.ptr_1
(%rip
), %rsi
40 ## References to this generate a symbol relocation
43 ## References to this generate a section relocation
47 .section __DATA,__const
48 ## These generate X86_64_RELOC_UNSIGNED non-pcrel section relocations