3 # RUN: rm -rf %t; split-file --no-leading-lines %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/ref-all.s -o %t/ref-all.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/ref-reexported.s -o %t/ref-reexported.o
7 ## Check that the hidden symbols(foo11) can't be referenced from HideFoo.tbd when current version is 11.
8 # RUN: not %lld -o /dev/null %t/libHideFoo.tbd %t/ref-all.o -dylib -platform_version macos 11.0.0 11.0.0 2>&1 | FileCheck %s --check-prefix=ERROR
10 ## Check that the hidden symbol(foo11) can be referenced when the current version is NOT 11.
11 # RUN: %lld -o %t/ref-foo-12.dylib %t/libHideFoo.tbd %t/ref-all.o -dylib -platform_version macos 12.0.0 12.0.0
12 # RUN: llvm-objdump --macho --bind %t/ref-foo-12.dylib | FileCheck %s --check-prefix=HAS-FOO
14 ## Check that when we link multiple tbd files, foo11 comes from the tbd where it is visible.
15 # RUN: %lld -o %t/ref-all.dylib %t/libHideFoo.tbd %t/libHasFoo.tbd %t/ref-all.o -dylib -platform_version macos 11.0.0 11.0.0
16 # RUN: llvm-objdump --macho --bind %t/ref-all.dylib | FileCheck %s --check-prefix=FOO
18 ## Check that '$hide$' has no effect on reexported symbols.
19 # RUN: %lld -o %t/reexport.dylib %t/libReexportSystem2.tbd %t/ref-reexported.o -dylib -platform_version macos 11.0.0 11.0.0
20 # RUN: llvm-objdump --macho --bind %t/reexport.dylib | FileCheck %s --check-prefix=REEXP
22 # ERROR: error: undefined symbol: _OBJC_CLASS_$_foo11
24 # HAS-FOO: __DATA __data {{.*}} pointer 0 /HideFoo _OBJC_CLASS_$_foo11
26 # FOO: segment section address type addend dylib symbol
27 # FOO-DAG: __DATA __data {{.*}} pointer 0 /HideFoo _OBJC_CLASS_$_bar
28 # FOO-DAG: __DATA __data {{.*}} pointer 0 /HideFoo _OBJC_CLASS_$_foo10
29 # FOO-DAG: __DATA __data {{.*}} pointer 0 /HasFoo _OBJC_CLASS_$_foo11
30 # FOO-DAG: __DATA __data {{.*}} pointer 0 /HideFoo _xxx
32 # REEXP: __DATA __data {{.*}} pointer 0 libSystem ___nan
37 .quad _OBJC_CLASS_$_foo11
38 .quad _OBJC_CLASS_$_foo10
39 .quad _OBJC_CLASS_$_bar
48 targets
: [ x86_64-macos
]
50 - target
: x86_64-macos
51 value
: 2E994C7F-
3F03-
3A07-
879C-
55690D22BEDA
52 install-name
: '/HideFoo'
54 compatibility-version
: 4.5.6
56 - targets
: [ x86_64-macos
]
57 symbols
: [ '$ld$hide$os11.0$_OBJC_CLASS_$_foo11', '$ld$hide$os10.0$_OBJC_CLASS_$_foo10', _xxx
]
58 objc-classes
: [foo10
, foo11
, bar
]
64 targets
: [ x86_64-macos
]
66 - target
: x86_64-macos
67 value
: 2E994C7F-
3F03-
3A07-
879C-
55690D22BEDB
68 install-name
: '/HasFoo'
70 compatibility-version
: 4.5.6
72 - targets
: [ x86_64-macos
]
74 objc-classes
: [foo10
, foo11
, bar
]
77 #--- libReexportSystem2.tbd
80 targets
: [ x86_64-macos
]
82 - target
: x86_64-macos
83 value
: 00000000-0000-0000-0000-000000000002
84 install-name
: '/libReexportSystem2'
87 - targets
: [ x86_64-macos
]
88 symbols
: [ '$ld$hide$___nan' ]
90 - targets
: [ x86_64-macos
]
91 libraries
: [ '/usr/lib/libSystem.dylib' ]