Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / link-search-at-executable-path.s
blob5e0b6636eac5f8de183e4e45cb35e798d1c5d850
1 # REQUIRES: x86
3 # RUN: rm -rf %t; split-file %s %t
4 # RUN: mkdir %t/subdir
6 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/foo.s -o %t/foo.o
7 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/bar.s -o %t/bar.o
8 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/main.s -o %t/main.o
10 # RUN: %lld -dylib -install_name @executable_path/libfoo.dylib %t/foo.o -o %t/subdir/libfoo.dylib
12 # RUN: %lld -dylib -reexport_library %t/subdir/libfoo.dylib %t/bar.o -o %t/libbar.dylib
14 ## When linking executables, @executable_path/ in install_name should be replaced
15 ## by the path of the executable.
16 # RUN: %lld -lSystem %t/main.o %t/libbar.dylib -o %t/subdir/test
18 ## This doesn't work for non-executables.
19 # RUN: not %lld -dylib -lSystem %t/main.o %t/libbar.dylib -o %t/subdir/libtest.dylib 2>&1 | FileCheck --check-prefix=ERR %s
21 ## It also doesn't help if the needed reexport isn't next to the library.
22 # RUN: not %lld -lSystem %t/main.o %t/libbar.dylib -o %t/test 2>&1 | FileCheck --check-prefix=ERR %s
23 # ERR: error: {{.*}}libbar.dylib: unable to locate re-export with install name @executable_path/libfoo.dylib
25 #--- foo.s
26 .globl _foo
27 _foo:
28 retq
30 #--- bar.s
31 .globl _bar
32 _bar:
33 retq
35 #--- main.s
36 .section __TEXT,__text
37 .global _main
38 _main:
39 callq _foo
40 callq _bar
41 ret