2 # RUN: rm -rf %t; mkdir %t
3 # RUN: yaml2obj %s > %t/test.dylib
4 # RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15 -o %t/test_macos.o
5 # RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-ios13.15.0-macabi -o %t/test_maccatalyst.o
6 # RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-ios13.15.0 -o %t/test_ios.o
8 ## Test linking against a zippered dylib.
9 # RUN: %lld -lSystem -dylib %t/test.dylib %t/test_macos.o -o /dev/null
10 # RUN: %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version mac-catalyst 13.15.0 14.0 %t/test.dylib %t/test_maccatalyst.o -o /dev/null
12 # RUN: %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version mac-catalyst 13.15.0 14.0 %t/test_maccatalyst.o -o /dev/null -framework MacOnly-Indirect
14 # RUN: not %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version mac-catalyst 13.15.0 14.0 %t/test_maccatalyst.o -o /dev/null -framework MacOnly 2>&1 | FileCheck --check-prefix=INCOMPATIBLE %s
15 # INCOMPATIBLE: System/Library/Frameworks{{[\\/]}}MacOnly.framework{{[\\/]}}MacOnly.tbd(MacOnly.dylib) is incompatible with x86_64 (macCatalyst13.15.0)
17 # RUN: not %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version ios 13.15.0 14.0 %t/test.dylib %t/test_ios.o -o /dev/null 2>&1 | FileCheck %s
18 # CHECK: test.dylib has platform macOS/macCatalyst, which is different from target platform iOS
20 ## Test creating a zippered dylib.
21 # RUN: %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version macos 12.0 13.0 -platform_version mac-catalyst 13.15.0 14.0 %t/test.dylib %t/test_macos.o -o %t/test_zippered.dylib
22 # RUN: llvm-otool -l %t/test_zippered.dylib | FileCheck --check-prefix=ZIPPERED %s
23 # ZIPPERED: cmd LC_BUILD_VERSION
24 # ZIPPERED-NEXT: cmdsize
25 # ZIPPERED-NEXT: platform 1
26 # ZIPPERED-NEXT: sdk 13.0
27 # ZIPPERED-NEXT: minos 12.0
28 # ZIPPERED-NEXT: ntools 1
30 # ZIPPERED-NEXT: version
31 # ZIPPERED-NEXT: Load command
32 # ZIPPERED-NEXT: cmd LC_BUILD_VERSION
33 # ZIPPERED-NEXT: cmdsize
34 # ZIPPERED-NEXT: platform 6
35 # ZIPPERED-NEXT: sdk 14.0
36 # ZIPPERED-NEXT: minos 13.15
37 # ZIPPERED-NEXT: ntools 1
39 # ZIPPERED-NEXT: version
41 # RUN: %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version macos 10.8 13.0 -platform_version mac-catalyst 13.15.0 14.0 %t/test.dylib %t/test_macos.o -o %t/test_zippered.dylib
42 # RUN: llvm-otool -l %t/test_zippered.dylib | FileCheck --check-prefix=ZIPPERED-OLD %s
43 # ZIPPERED-OLD: cmd LC_VERSION_MIN_MACOSX
44 # ZIPPERED-OLD-NEXT: cmdsize
45 # ZIPPERED-OLD-NEXT: version 10.8
46 # ZIPPERED-OLD-NEXT: sdk 13.0
47 # ZIPPERED-OLD-NEXT: Load command
48 # ZIPPERED-OLD-NEXT: cmd LC_BUILD_VERSION
49 # ZIPPERED-OLD-NEXT: cmdsize
50 # ZIPPERED-OLD-NEXT: platform 6
51 # ZIPPERED-OLD-NEXT: sdk 14.0
52 # ZIPPERED-OLD-NEXT: minos 13.15
53 # ZIPPERED-OLD-NEXT: ntools 1
54 # ZIPPERED-OLD-NEXT: tool
55 # ZIPPERED-OLD-NEXT: version
57 # RUN: not %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -arch x86_64 -platform_version macos 10.8 13.0 -platform_version mac-catalyst 13.15.0 14.0 %t/test.dylib %t/test_macos.o -o %t/test_zippered.dylib 2>&1 | FileCheck --check-prefix=ZIPPERED-EXE %s
58 # ZIPPERED-EXE: writing zippered outputs only valid for -dylib and -bundle
60 ## Reject .o files which only have the secondary platform.
61 # RUN: not %no-arg-lld -syslibroot %S/Inputs/MacOSX.sdk -lSystem -dylib -arch x86_64 -platform_version macos 12.0 13.0 -platform_version mac-catalyst 13.15.0 14.0 %t/test.dylib %t/test_maccatalyst.o -o %t/test_zippered.dylib 2>&1 | FileCheck --check-prefix=CAT %s
62 # CAT: test_maccatalyst.o has platform macCatalyst, which is different from target platform macOS
81 compatibility_version: 0
84 - cmd: LC_DYLD_INFO_ONLY
96 - cmd: LC_BUILD_VERSION
105 - cmd: LC_BUILD_VERSION