Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / dylink-ordinal.s
blobc1474455260c6852adeaefc378a86321b6f0ec8f
1 # REQUIRES: x86
3 ## --no-leading-lines needed for .tbd files.
4 # RUN: rm -rf %t; split-file --no-leading-lines %s %t
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/main.s -o %t/main.o
7 # RUN: %lld -o %t/main -L%t -lFoo -lBar -lSystem %t/main.o
8 # RUN: llvm-objdump --lazy-bind -d --no-show-raw-insn %t/main | FileCheck %s
10 # CHECK: callq 0x[[#%x,FOO_OFF:]]
11 # CHECK-NEXT: callq 0x[[#%x,BAR_OFF:]]
13 # CHECK: [[#%x,BAR_OFF]]: jmpq {{.*}} ## 0x[[#%x,BAR_BIND:]]
14 # CHECK: [[#%x,FOO_OFF]]: jmpq {{.*}} ## 0x[[#%x,FOO_BIND:]]
16 # CHECK-LABEL: Lazy bind table:
17 # CHECK-DAG: __DATA __la_symbol_ptr 0x[[#%x,FOO_BIND]] Foo _foo
18 # CHECK-DAG: __DATA __la_symbol_ptr 0x[[#%x,BAR_BIND]] Foo _bar
20 # RUN: llvm-nm -m %t/main | FileCheck --check-prefix=NM %s
22 # NM-DAG: _bar (from Foo)
23 # NM-DAG: _foo (from Foo)
25 # RUN: llvm-otool -L %t/main | FileCheck %s --check-prefix=LOAD
27 # LOAD: Foo.dylib
28 # LOAD-NOT: Foo.dylib
30 #--- libFoo.tbd
31 --- !tapi-tbd
32 tbd-version: 4
33 targets: [ x86_64-macos ]
34 uuids:
35 - target: x86_64-macos
36 value: 00000000-0000-0000-0000-000000000000
37 install-name: 'Foo.dylib'
38 current-version: 0001.001.1
39 exports:
40 - targets: [ x86_64-macos ]
41 symbols: [ _foo ]
42 ...
44 #--- libBar.tbd
45 --- !tapi-tbd
46 tbd-version: 4
47 targets: [ x86_64-macos ]
48 uuids:
49 - target: x86_64-macos
50 value: 00000000-0000-0000-0000-000000000000
51 ## Also uses Foo.dylib as install-name!
52 ## Normally, this would happen conditionally via an $ld$ symbol.
53 install-name: 'Foo.dylib'
54 current-version: 0001.001.1
55 exports:
56 - targets: [ x86_64-macos ]
57 symbols: [ _bar ]
58 ...
60 #--- main.s
61 .section __TEXT,__text
62 .globl _main, _foo, _bar
64 _main:
65 callq _foo
66 callq _bar
67 ret