2 # RUN: rm -rf %t; split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/foo.s -o %t/foo.o
4 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/bar.s -o %t/bar.o
5 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/test.s -o %t/test.o
7 ## Dylibs that don't do lazy dynamic calls don't need dyld_stub_binder.
8 # RUN: %no-lsystem-lld -arch arm64 -dylib %t/foo.o -o %t/libfoo.dylib
9 # RUN: llvm-nm -m %t/libfoo.dylib | FileCheck --check-prefix=NOSTUB %s
11 ## Binaries that don't do lazy dynamic calls but are linked against
12 ## libSystem.dylib get a reference to dyld_stub_binder even if it's
14 # RUN: %lld -arch arm64 -lSystem -dylib %t/foo.o -o %t/libfoo.dylib
15 # RUN: llvm-nm -m %t/libfoo.dylib | FileCheck --check-prefix=STUB %s
18 ## Dylibs that do lazy dynamic calls do need dyld_stub_binder.
19 # RUN: not %no-lsystem-lld -arch arm64 -dylib %t/bar.o %t/libfoo.dylib \
20 # RUN: -o %t/libbar.dylib 2>&1 | FileCheck --check-prefix=MISSINGSTUB %s
21 # RUN: %lld -arch arm64 -lSystem -dylib %t/bar.o %t/libfoo.dylib \
22 # RUN: -o %t/libbar.dylib
23 # RUN: llvm-nm -m %t/libbar.dylib | FileCheck --check-prefix=STUB %s
26 # RUN: not %no-lsystem-lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
27 # RUN: -o %t/test 2>&1 | FileCheck --check-prefix=MISSINGSTUB %s
28 # RUN: %lld -arch arm64 -lSystem %t/libfoo.dylib %t/libbar.dylib %t/test.o \
30 # RUN: llvm-nm -m %t/test | FileCheck --check-prefix=STUB %s
32 ## Test dynamic lookup of dyld_stub_binder.
33 # RUN: %no-lsystem-lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
34 # RUN: -o %t/test -undefined dynamic_lookup
35 # RUN: llvm-nm -m %t/test | FileCheck --check-prefix=DYNSTUB %s
36 # RUN: %no-lsystem-lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
37 # RUN: -o %t/test -U dyld_stub_binder
38 # RUN: llvm-nm -m %t/test | FileCheck --check-prefix=DYNSTUB %s
40 # MISSINGSTUB: error: undefined symbol: dyld_stub_binder
41 # MISSINGSTUB-NEXT: >>> referenced by lazy binding (normally in libSystem.dylib)
43 # NOSTUB-NOT: dyld_stub_binder
44 # STUB: (undefined) external dyld_stub_binder (from libSystem)
45 # DYNSTUB: (undefined) external dyld_stub_binder (dynamically looked up)