2 # RUN: rm -rf %t; split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/libfoo.s -o %t/libfoo.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/bar.s -o %t/bar.o
6 # RUN: %lld -dylib %t/libfoo.o -o %t/libfoo.dylib -lSystem
7 # RUN: %lld %t/test.o %t/bar.o %t/libfoo.dylib -o %t/test -lSystem
8 # RUN: llvm-objdump --macho -d --no-show-raw-insn --indirect-symbols %t/test | FileCheck %s
9 # RUN: llvm-otool -l %t/test | FileCheck --check-prefix=DYSYMTAB %s
11 # CHECK: (__TEXT,__text) section
13 # CHECK-NEXT: movq {{.*}}(%rip), %rax ## literal pool symbol address: _foo
14 # CHECK-NEXT: movq {{.*}}(%rip), %rax ## literal pool symbol address: _bar
15 # CHECK-NEXT: leaq _baz(%rip), %rax
16 # CHECK-NEXT: addq {{.*}}(%rip), %rax
17 # CHECK-NEXT: movq {{.*}}(%rip), %rax ## literal pool symbol address: _foo_tlv
18 # CHECK-NEXT: movq {{.*}}(%rip), %rax ## literal pool symbol address: _bar_tlv
19 # CHECK-NEXT: callq {{.*}} ## symbol stub for: _foo_fn
20 # CHECK-NEXT: callq {{.*}} ## symbol stub for: _bar_fn
23 # CHECK: Indirect symbols for (__TEXT,__stubs) 2 entries
24 # CHECK-NEXT: address index name
27 # CHECK-NEXT: Indirect symbols for (__DATA_CONST,__got) 4 entries
28 # CHECK-NEXT: address index name
32 # CHECK-NEXT: _stub_binder
33 # CHECK-NEXT: Indirect symbols for (__DATA,__la_symbol_ptr) 2 entries
34 # CHECK-NEXT: address index name
37 # CHECK-NEXT: Indirect symbols for (__DATA,__thread_ptrs) 2 entries
38 # CHECK-NEXT: address index name
39 # CHECK-NEXT: _bar_tlv
40 # CHECK-NEXT: _foo_tlv
42 # DYSYMTAB: nindirectsyms 10
46 .globl _foo, _foo_fn, _bar, _bar_fn
52 .section __DATA,__thread_vars,thread_local_variables
53 .globl _foo_tlv, _bar_tlv
61 movq _foo@GOTPCREL
(%rip
), %rax
62 movq _bar@GOTPCREL
(%rip
), %rax
63 movq _baz@GOTPCREL
(%rip
), %rax
64 addq _quux@GOTPCREL
(%rip
), %rax
65 mov _foo_tlv@TLVP
(%rip
), %rax
66 mov _bar_tlv@TLVP
(%rip
), %rax
74 .private_extern _baz,_quux