Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / special-symbol-ld-install-name.s
blob0feb2bfb5bd1d2e28dfde3a0603789ffbaf3031a
1 # REQUIRES: x86
3 # RUN: rm -rf %t; split-file --no-leading-lines %s %t
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
7 ## Case 1: special symbol $ld$install_name affects the install name
8 ## since the specified version 11.0.0 matches the target version 11.0.0
10 # RUN: %lld -o %t/libfoo1.dylib %t/libLDInstallName.tbd %t/foo.o -dylib -platform_version macos 11.0.0 11.0.0
11 # RUN: llvm-otool -L %t/libfoo1.dylib | FileCheck --check-prefix=CASE1 %s
12 # CASE1: /New (compatibility version 1.1.1, current version 5.0.0)
14 ## Case 2: special symbol $ld$install_name does not affect the install name
15 ## since the specified version 11.0.0 does not match the target version 12.0.0
17 # RUN: %lld -o %t/libfoo2.dylib %t/libLDInstallName.tbd %t/foo.o -dylib -platform_version macos 12.0.0 12.0.0
18 # RUN: llvm-otool -L %t/libfoo2.dylib | FileCheck --check-prefix=CASE2 %s
19 # CASE2: /Old (compatibility version 1.1.1, current version 5.0.0)
21 ## Check that we emit a warning for an invalid os version.
23 # RUN: %no-fatal-warnings-lld -o %t/libfoo3.dylib %t/libLDInstallNameInvalid.tbd %t/foo.o -dylib \
24 # RUN: -platform_version macos 11.0.0 11.0.0 2>&1 | FileCheck --check-prefix=INVALID-VERSION %s
26 # INVALID-VERSION: libLDInstallNameInvalid.tbd(/Old): failed to parse os version, symbol '$ld$install_name$os11.a$/New' ignored
28 ## Case 3: If there's another library that has '/New' as its original
29 ## install_name, we should take current-version and compatibility-version from
30 ## the first library we load with that install name. For a reexport,
31 ## the first loaded library is the library doing the reexport, not the
32 ## reexported library.
33 # RUN: %lld -o %t/libfoo3.dylib %t/libLDInstallNameNew.tbd %t/foo.o -dylib -platform_version macos 11.0.0 11.0.0
34 # RUN: llvm-otool -L %t/libfoo3.dylib | FileCheck --check-prefix=CASE3 %s
35 # RUN: %lld -o %t/libfoo3.dylib %t/libLDInstallName.tbd %t/libLDInstallNameNew.tbd %t/foo.o -dylib -platform_version macos 11.0.0 11.0.0
36 # RUN: llvm-otool -L %t/libfoo3.dylib | FileCheck --check-prefix=CASE1 %s
37 # RUN: %lld -o %t/libfoo3.dylib %t/libLDInstallNameNew.tbd %t/libLDInstallName.tbd %t/foo.o -dylib -platform_version macos 11.0.0 11.0.0
38 # RUN: llvm-otool -L %t/libfoo3.dylib | FileCheck --check-prefix=CASE3 %s
39 # CASE3: /New (compatibility version 4.5.6, current version 9.0.0)
41 #--- foo.s
42 .long _xxx@GOTPCREL
44 #--- libLDInstallName.tbd
45 --- !tapi-tbd-v3
46 archs: [ x86_64 ]
47 uuids: [ 'x86_64: 19311012-01AB-342E-812B-73A74271A715' ]
48 platform: macosx
49 install-name: '/Old'
50 current-version: 5
51 compatibility-version: 1.1.1
52 exports:
53 - archs: [ x86_64 ]
54 symbols: [ '$ld$install_name$os11.0$/New', _xxx ]
55 ...
57 #--- libLDInstallNameInvalid.tbd
58 --- !tapi-tbd-v3
59 archs: [ x86_64 ]
60 uuids: [ 'x86_64: 19311011-01AB-342E-112B-73A74271A715' ]
61 platform: macosx
62 install-name: '/Old'
63 current-version: 5
64 compatibility-version: 1.1.1
65 exports:
66 - archs: [ x86_64 ]
67 symbols: [ '$ld$install_name$os11.a$/New', _xxx ]
68 ...
70 #--- libLDInstallNameNew.tbd
71 --- !tapi-tbd
72 tbd-version: 4
73 targets: [ x86_64-macos ]
74 uuids:
75 - target: x86_64-macos
76 value: 2E994C7F-3F03-3A07-879C-55690D22BEDA
77 install-name: '/New'
78 current-version: 9
79 compatibility-version: 4.5.6
80 reexported-libraries:
81 - targets: [ x86_64-macos ]
82 libraries: [ '@loader_path/libLDInstallName' ]
83 ...