[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / lld / test / MachO / link-search-order.s
blob9bb97992cb2716c24a38b2169d081826a06a2ee8
1 # REQUIRES: x86
3 ################ Place dynlib in %tD, and archive in %tA
4 # RUN: rm -rf %t %tA %tD
5 # RUN: mkdir -p %t %tA %tD
7 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %p/Inputs/libhello.s -o %t/hello.o
8 # RUN: %lld -dylib -install_name @executable_path/libhello.dylib %t/hello.o -o %t/libhello.dylib
10 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %p/Inputs/libgoodbye.s -o %t/goodbye.o
11 # RUN: %lld -dylib -install_name @executable_path/libgoodbye.dylib %t/goodbye.o -o %tD/libgoodbye.dylib
12 # RUN: llvm-ar --format=darwin crs %tA/libgoodbye.a %t/goodbye.o
14 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %s -o %t/test.o
16 ################ default, which is the same as -search_paths_first
17 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
18 # RUN: -L%tA -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o \
19 # RUN: --print-dylib-search | FileCheck --check-prefix=ARCHIVESEARCH -DPATH=%t %s
20 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
22 ################ Test all permutations of -L%t{A,D} with -search_paths_first
23 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
24 # RUN: -L%tA -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
25 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
26 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
27 # RUN: -L%tD -L%tA -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
28 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
29 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
30 # RUN: -L%tA -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
31 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
32 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
33 # RUN: -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
34 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
36 ################ Test all permutations of -L%t{A,D} with -search_dylibs_first
37 # RUN: env RC_TRACE_DYLIB_SEARCHING=1 %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
38 # RUN: -L%tA -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first \
39 # RUN: | FileCheck --check-prefix=DYLIBSEARCH -DPATH=%t %s
40 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
41 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
42 # RUN: -L%tD -L%tA -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first
43 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
44 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
45 # RUN: -L%tA -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first
46 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
47 # RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
48 # RUN: -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first
49 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
51 ################ Test that we try the tbd file before the binary for frameworks too.
52 # RUN: not %lld -dylib -F %t -framework Foo -o %t --print-dylib-search \
53 # RUN: | FileCheck --check-prefix=FRAMEWORKSEARCH -DPATH=%t %s
55 # DYLIB: @executable_path/libhello.dylib
56 # DYLIB: @executable_path/libgoodbye.dylib
57 # DYLIB: /usr/lib/libSystem.dylib
59 # DYLIBSEARCH: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.tbd, not found
60 # DYLIBSEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.dylib, not found
61 # DYLIBSEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.so, not found
62 # DYLIBSEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.tbd, not found
63 # DYLIBSEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.dylib, not found
64 # DYLIBSEARCH: searched [[PATH]]{{[/\\]}}libhello.dylib, found
65 # DYLIBSEARCH: searched [[PATH]]D{{[/\\]}}libgoodbye.dylib, found
67 # ARCHIVE: @executable_path/libhello.dylib
68 # ARCHIVE-NOT: @executable_path/libgoodbye.dylib
69 # ARCHIVE: /usr/lib/libSystem.dylib
71 # ARCHIVESEARCH: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.tbd, not found
72 # ARCHIVESEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.dylib, not found
73 # ARCHIVESEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.so, not found
74 # ARCHIVESEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.a, not found
75 # ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.tbd, not found
76 # ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.dylib, not found
77 # ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.so, not found
78 # ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.a, not found
79 # ARCHIVESEARCH: searched [[PATH]]{{[/\\]}}libhello.dylib, found
80 # ARCHIVESEARCH: searched [[PATH]]A{{[/\\]}}libgoodbye.a, found
82 # FRAMEWORKSEARCH: searched [[PATH]]{{[/\\]}}Foo.framework{{[/\\]}}Foo.tbd, not found
83 # FRAMEWORKSEARCH-NEXT: searched [[PATH]]{{[/\\]}}Foo.framework{{[/\\]}}Foo, not found
85 .section __TEXT,__text
86 .global _main
88 _main:
89 movl $0x2000004, %eax # write()
90 mov $1, %rdi # stdout
91 movq _hello_world@GOTPCREL(%rip), %rsi
92 mov $13, %rdx # length
93 syscall
95 movl $0x2000004, %eax # write()
96 mov $1, %rdi # stdout
97 movq _hello_its_me@GOTPCREL(%rip), %rsi
98 mov $15, %rdx # length
99 syscall
101 movl $0x2000004, %eax # write()
102 mov $1, %rdi # stdout
103 movq _goodbye_world@GOTPCREL(%rip), %rsi
104 mov $15, %rdx # length
105 syscall
106 mov $0, %rax