[lld] 0634a84 - [lld-macho][test] Add -lSystem to all lld invocations

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 14:21:12 PDT 2022


Author: Keith Smiley
Date: 2022-10-04T14:10:43-07:00
New Revision: 0634a8440d63359e8f0e6674c192524bb404909f

URL: https://github.com/llvm/llvm-project/commit/0634a8440d63359e8f0e6674c192524bb404909f
DIFF: https://github.com/llvm/llvm-project/commit/0634a8440d63359e8f0e6674c192524bb404909f.diff

LOG: [lld-macho][test] Add -lSystem to all lld invocations

This is a requirement from ld64, so this mirrors that expectation. Most
of these changes were just offsets from adding the library, or adding
dyld_stub_binder which is always added when linking ld64. This also adds
`%no-lsystem-lld` for the few cases where we're explicitly testing
things without that.

Fixes: https://github.com/llvm/llvm-project/issues/54184

Differential Revision: https://reviews.llvm.org/D135193

Added: 
    

Modified: 
    lld/test/MachO/adhoc-codesign-hash.s
    lld/test/MachO/arm-dtrace.s
    lld/test/MachO/arm64-32-dtrace.s
    lld/test/MachO/bind-opcodes.s
    lld/test/MachO/dead-strip.s
    lld/test/MachO/dyld-stub-binder.s
    lld/test/MachO/dylink.s
    lld/test/MachO/headerpad.s
    lld/test/MachO/lc-linker-option.ll
    lld/test/MachO/link-search-order.s
    lld/test/MachO/lit.local.cfg
    lld/test/MachO/local-symbol-output.s
    lld/test/MachO/map-file.s
    lld/test/MachO/search-paths.test

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/adhoc-codesign-hash.s b/lld/test/MachO/adhoc-codesign-hash.s
index 937f29c06059..977ca43cf088 100644
--- a/lld/test/MachO/adhoc-codesign-hash.s
+++ b/lld/test/MachO/adhoc-codesign-hash.s
@@ -9,15 +9,15 @@
 # RUN: %lld -arch arm64 -dylib -adhoc_codesign -o %t/empty-arm64-iossimulator.dylib %t/empty-arm64-iossimulator.o
 # RUN: %lld -arch x86_64 -dylib -adhoc_codesign -o %t/empty-x86_64-macos.dylib %t/empty-x86_64-macos.o
 
-# RUN: obj2yaml %t/empty-arm64-macos.dylib | FileCheck %s -D#DATA_OFFSET=16400 -D#DATA_SIZE=304
-# RUN: obj2yaml %t/empty-arm64-iossimulator.dylib | FileCheck %s -D#DATA_OFFSET=16400 -D#DATA_SIZE=304
-# RUN: obj2yaml %t/empty-x86_64-macos.dylib | FileCheck %s -D#DATA_OFFSET=4112 -D#DATA_SIZE=208
+# RUN: obj2yaml %t/empty-arm64-macos.dylib | FileCheck %s -D#DATA_OFFSET=16432 -D#DATA_SIZE=304
+# RUN: obj2yaml %t/empty-arm64-iossimulator.dylib | FileCheck %s -D#DATA_OFFSET=16432 -D#DATA_SIZE=304
+# RUN: obj2yaml %t/empty-x86_64-macos.dylib | FileCheck %s -D#DATA_OFFSET=4144 -D#DATA_SIZE=208
 
 # CHECK:    - cmd:             LC_CODE_SIGNATURE
 # CHECK-NEXT: cmdsize:         16
 # CHECK-NEXT: dataoff:         [[#DATA_OFFSET]]
 # CHECK-NEXT: datasize:        [[#DATA_SIZE]]
 
-# RUN: %python %p/Inputs/code-signature-check.py %t/empty-arm64-macos.dylib 16400 304 0 16400
-# RUN: %python %p/Inputs/code-signature-check.py %t/empty-arm64-iossimulator.dylib 16400 304 0 16400
-# RUN: %python %p/Inputs/code-signature-check.py %t/empty-x86_64-macos.dylib 4112 208 0 4112
+# RUN: %python %p/Inputs/code-signature-check.py %t/empty-arm64-macos.dylib 16432 304 0 16432
+# RUN: %python %p/Inputs/code-signature-check.py %t/empty-arm64-iossimulator.dylib 16432 304 0 16432
+# RUN: %python %p/Inputs/code-signature-check.py %t/empty-x86_64-macos.dylib 4144 208 0 4144

diff  --git a/lld/test/MachO/arm-dtrace.s b/lld/test/MachO/arm-dtrace.s
index 4d69d56542c5..800c8fe0323c 100644
--- a/lld/test/MachO/arm-dtrace.s
+++ b/lld/test/MachO/arm-dtrace.s
@@ -1,8 +1,10 @@
 # REQUIRES: arm
 # RUN: rm -rf %t; split-file %s %t
 
+# TODO: Replace %no-lsystem-lld with %lld
+
 # RUN: llvm-mc -filetype=obj -triple=armv4t-apple-darwin %t/armv4t-dtrace.s -o %t/armv4t-dtrace.o
-# RUN: %lld -arch armv4t -o %t/armv4t-dtrace %t/armv4t-dtrace.o
+# RUN: %no-lsystem-lld -arch armv4t -o %t/armv4t-dtrace %t/armv4t-dtrace.o
 
 ## If references of dtrace symbols are handled by lld, their relocation should be replaced with the following instructions
 # RUN: llvm-objdump --macho -D %t/armv4t-dtrace | FileCheck %s --check-prefix=CHECK-armv4t
@@ -12,7 +14,7 @@
 # CHECK-armv4t: 00 00 a0 e1  mov     r0, r0
 
 # RUN: llvm-mc -filetype=obj -triple=thumbv7-apple-darwin %t/armv7-dtrace.s -o %t/armv7-dtrace.o
-# RUN: %lld -arch armv7 -o %t/armv7-dtrace %t/armv7-dtrace.o
+# RUN: %no-lsystem-lld -arch armv7 -o %t/armv7-dtrace %t/armv7-dtrace.o
 
 ## If references of dtrace symbols are handled by lld, their relocation should be replaced with the following instructions
 # RUN: llvm-objdump --macho -D %t/armv7-dtrace | FileCheck %s --check-prefix=CHECK-armv7

diff  --git a/lld/test/MachO/arm64-32-dtrace.s b/lld/test/MachO/arm64-32-dtrace.s
index 23e45f63085e..26c91bd28831 100644
--- a/lld/test/MachO/arm64-32-dtrace.s
+++ b/lld/test/MachO/arm64-32-dtrace.s
@@ -1,8 +1,8 @@
 # REQUIRES: aarch64
 # RUN: rm -rf %t; split-file %s %t
 
-# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-darwin %t/arm64-32-dtrace.s -o %t/arm64-32-dtrace.o
-# RUN: %lld -arch arm64_32 -o %t/arm64-32-dtrace %t/arm64-32-dtrace.o
+# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %t/arm64-32-dtrace.s -o %t/arm64-32-dtrace.o
+# RUN: %lld-watchos -arch arm64_32 -o %t/arm64-32-dtrace %t/arm64-32-dtrace.o
 
 ## If references of dtrace symbols are handled by lld, their relocation should be replaced with the following instructions
 # RUN: llvm-objdump --macho -D %t/arm64-32-dtrace | FileCheck %s --check-prefix=CHECK

diff  --git a/lld/test/MachO/bind-opcodes.s b/lld/test/MachO/bind-opcodes.s
index cc798b3c41ca..cf294f2f7f42 100644
--- a/lld/test/MachO/bind-opcodes.s
+++ b/lld/test/MachO/bind-opcodes.s
@@ -89,7 +89,7 @@
 # CHECK32-NEXT:   Imm:             1
 # CHECK32-NEXT:   Symbol:          ''
 # CHECK32-NEXT:   Opcode:          BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
-# CHECK32-NEXT:   Imm:             1
+# CHECK32-NEXT:   Imm:             2
 # CHECK32-NEXT:   Symbol:          ''
 # CHECK32-NEXT:   Opcode:          BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
 # CHECK32-NEXT:   Imm:             1

diff  --git a/lld/test/MachO/dead-strip.s b/lld/test/MachO/dead-strip.s
index 20cfd95f966e..ef92a9620288 100644
--- a/lld/test/MachO/dead-strip.s
+++ b/lld/test/MachO/dead-strip.s
@@ -265,13 +265,13 @@
 # UNWIND-NEXT:   l O __DATA,__data __dyld_private
 # UNWIND-NEXT:   g F __TEXT,__text _main
 # UNWIND-NEXT:   g F __TEXT,__text __mh_execute_header
+# UNWIND-NEXT:   *UND* dyld_stub_binder
 # UNWIND-NEXT:   *UND* ___cxa_allocate_exception
 # UNWIND-NEXT:   *UND* ___cxa_end_catch
 # UNWIND-NEXT:   *UND* __ZTIi
 # UNWIND-NEXT:   *UND* ___cxa_throw
 # UNWIND-NEXT:   *UND* ___gxx_personality_v0
 # UNWIND-NEXT:   *UND* ___cxa_begin_catch
-# UNWIND-NEXT:   *UND* dyld_stub_binder
 # UNWIND-NOT:    GCC_except_table0
 
 ## If a dead stripped function has a strong ref to a dylib symbol but

diff  --git a/lld/test/MachO/dyld-stub-binder.s b/lld/test/MachO/dyld-stub-binder.s
index 475ece2d8be7..1d2e556607c7 100644
--- a/lld/test/MachO/dyld-stub-binder.s
+++ b/lld/test/MachO/dyld-stub-binder.s
@@ -5,7 +5,7 @@
 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/test.s -o %t/test.o
 
 ## Dylibs that don't do lazy dynamic calls don't need dyld_stub_binder.
-# RUN: %lld -arch arm64 -dylib %t/foo.o -o %t/libfoo.dylib
+# RUN: %no-lsystem-lld -arch arm64 -dylib %t/foo.o -o %t/libfoo.dylib
 # RUN: llvm-nm -m %t/libfoo.dylib | FileCheck --check-prefix=NOSTUB %s
 
 ## Binaries that don't do lazy dynamic calls but are linked against
@@ -16,24 +16,24 @@
 
 
 ## Dylibs that do lazy dynamic calls do need dyld_stub_binder.
-# RUN: not %lld -arch arm64 -dylib %t/bar.o %t/libfoo.dylib \
+# RUN: not %no-lsystem-lld -arch arm64 -dylib %t/bar.o %t/libfoo.dylib \
 # RUN:     -o %t/libbar.dylib 2>&1 | FileCheck --check-prefix=MISSINGSTUB %s
 # RUN: %lld -arch arm64 -lSystem -dylib %t/bar.o  %t/libfoo.dylib \
 # RUN:     -o %t/libbar.dylib
 # RUN: llvm-nm -m %t/libbar.dylib | FileCheck --check-prefix=STUB %s
 
 ## As do executables.
-# RUN: not %lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
+# RUN: not %no-lsystem-lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
 # RUN:     -o %t/test 2>&1 | FileCheck --check-prefix=MISSINGSTUB %s
 # RUN: %lld -arch arm64 -lSystem %t/libfoo.dylib %t/libbar.dylib %t/test.o \
 # RUN:     -o %t/test
 # RUN: llvm-nm -m %t/test | FileCheck --check-prefix=STUB %s
 
 ## Test dynamic lookup of dyld_stub_binder.
-# RUN: %lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
+# RUN: %no-lsystem-lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
 # RUN:     -o %t/test -undefined dynamic_lookup
 # RUN: llvm-nm -m %t/test | FileCheck --check-prefix=DYNSTUB %s
-# RUN: %lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
+# RUN: %no-lsystem-lld -arch arm64 %t/libfoo.dylib %t/libbar.dylib %t/test.o \
 # RUN:     -o %t/test -U dyld_stub_binder
 # RUN: llvm-nm -m %t/test | FileCheck --check-prefix=DYNSTUB %s
 

diff  --git a/lld/test/MachO/dylink.s b/lld/test/MachO/dylink.s
index 0330a85d5504..97f1097d4c5d 100644
--- a/lld/test/MachO/dylink.s
+++ b/lld/test/MachO/dylink.s
@@ -52,6 +52,9 @@
 # RUN: llvm-objdump --macho --all-headers %t/dylink | FileCheck %s \
 # RUN:   --check-prefix=LOAD --implicit-check-not LC_LOAD_DYLIB
 
+# LOAD:                        cmd LC_LOAD_DYLIB
+# LOAD-NEXT:               cmdsize
+# LOAD-NEXT:                  name /usr/lib/libSystem.dylib
 # LOAD:                        cmd LC_LOAD_DYLIB
 # LOAD-NEXT:               cmdsize
 # LOAD-NEXT:                  name @executable_path/libhello.dylib

diff  --git a/lld/test/MachO/headerpad.s b/lld/test/MachO/headerpad.s
index fa59a9f79d8a..bc2f3519e32f 100644
--- a/lld/test/MachO/headerpad.s
+++ b/lld/test/MachO/headerpad.s
@@ -24,9 +24,9 @@
 # PADx-NEXT: offset [[#%u, CMDSIZE + 0x20 + 0x20]]
 
 ################ Zero pad, no LCDylibs
-# RUN: %lld -o %t/test %t/test.o -headerpad 0
+# RUN: %no-lsystem-lld -o %t/test %t/test.o -headerpad 0
 # RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD0
-# RUN: %lld -o %t/test %t/test.o -headerpad 0 -headerpad_max_install_names
+# RUN: %no-lsystem-lld -o %t/test %t/test.o -headerpad 0 -headerpad_max_install_names
 # RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD0
 #
 # PAD0:      magic        {{.+}}  ncmds  sizeofcmds         flags
@@ -38,11 +38,11 @@
 # PAD0-NEXT: offset [[#%u, CMDSIZE + 0x20 + 0]]
 
 ################ Each lexical form of a hex number, no LCDylibs
-# RUN: %lld -o %t/test %t/test.o -headerpad 11
+# RUN: %no-lsystem-lld -o %t/test %t/test.o -headerpad 11
 # RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD11
-# RUN: %lld -o %t/test %t/test.o -headerpad 0x11
+# RUN: %no-lsystem-lld -o %t/test %t/test.o -headerpad 0x11
 # RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD11
-# RUN: %lld -o %t/test %t/test.o -headerpad 0X11 -headerpad_max_install_names
+# RUN: %no-lsystem-lld -o %t/test %t/test.o -headerpad 0X11 -headerpad_max_install_names
 # RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD11
 #
 # PAD11:      magic        {{.+}}  ncmds  sizeofcmds         flags

diff  --git a/lld/test/MachO/lc-linker-option.ll b/lld/test/MachO/lc-linker-option.ll
index d6b501f66375..4d2d695337cf 100644
--- a/lld/test/MachO/lc-linker-option.ll
+++ b/lld/test/MachO/lc-linker-option.ll
@@ -17,7 +17,7 @@
 ;; which needs -lSystem from LC_LINKER_OPTION to get resolved.
 ;; The reference to __cxa_allocate_exception will require -lc++ from
 ;; LC_LINKER_OPTION to get resolved.
-; RUN: %lld %t/l.o -o %t/l -framework CoreFoundation
+; RUN: %no-lsystem-lld %t/l.o -o %t/l -framework CoreFoundation
 ; RUN: llvm-otool -l %t/l | FileCheck --check-prefix=LIB %s \
 ; RUN:  --implicit-check-not LC_LOAD_DYLIB
 ; LIB:          cmd LC_LOAD_DYLIB
@@ -31,7 +31,7 @@
 ; LIB-NEXT:    name /usr/lib/libc++abi.dylib
 
 ;; Check that we don't create duplicate LC_LOAD_DYLIBs.
-; RUN: %lld -lSystem %t/l.o -o %t/l -framework CoreFoundation
+; RUN: %no-lsystem-lld -lSystem %t/l.o -o %t/l -framework CoreFoundation
 ; RUN: llvm-otool -l %t/l | FileCheck --check-prefix=LIB2 %s \
 ; RUN:  --implicit-check-not LC_LOAD_DYLIB
 ; LIB2:          cmd LC_LOAD_DYLIB
@@ -75,6 +75,7 @@
 ; SYMS:       SYMBOL TABLE:
 ; SYMS-NEXT:  g     F __TEXT,__text _main
 ; SYMS-NEXT:  g     F __TEXT,__text __mh_execute_header
+; SYMS-NEXT:  *UND* dyld_stub_binder
 ; SYMS-EMPTY:
 
 ;; Make sure -all_load has effect when libraries are loaded via LC_LINKER_OPTION flags and explicitly passed as well
@@ -86,6 +87,7 @@
 ; SYMS_ALL_LOAD-NEXT:  g     F __TEXT,__text _main
 ; SYMS_ALL_LOAD-NEXT:  g     O __DATA,__objc_data _OBJC_CLASS_$_TestClass
 ; SYMS_ALL_LOAD-NEXT:  g     F __TEXT,__text __mh_execute_header
+; SYMS_ALL_LOAD-NEXT:  *UND* dyld_stub_binder
 ; SYMS_ALL_LOAD-EMPTY:
 
 ;; Make sure -force_load has effect when libraries are loaded via LC_LINKER_OPTION flags and explicitly passed as well
@@ -97,6 +99,7 @@
 ; SYMS_FORCE_LOAD-NEXT:  g     F __TEXT,__text _main
 ; SYMS_FORCE_LOAD-NEXT:  g     O __DATA,__objc_data _OBJC_CLASS_$_TestClass
 ; SYMS_FORCE_LOAD-NEXT:  g     F __TEXT,__text __mh_execute_header
+; SYMS_FORCE_LOAD-NEXT:  *UND* dyld_stub_binder
 ; SYMS_FORCE_LOAD-EMPTY:
 
 ;; Make sure -ObjC has effect when frameworks are loaded via LC_LINKER_OPTION flags and explicitly passed as well
@@ -108,6 +111,7 @@
 ; SYMS_OBJC_LOAD-NEXT:  g     F __TEXT,__text _main
 ; SYMS_OBJC_LOAD-NEXT:  g     O __DATA,__objc_data _OBJC_CLASS_$_TestClass
 ; SYMS_OBJC_LOAD-NEXT:  g     F __TEXT,__text __mh_execute_header
+; SYMS_OBJC_LOAD-NEXT:  *UND* dyld_stub_binder
 ; SYMS_OBJC_LOAD-EMPTY:
 
 ;; Make sure that frameworks containing object files or bitcode instead of

diff  --git a/lld/test/MachO/link-search-order.s b/lld/test/MachO/link-search-order.s
index 9996b9ae66ae..0331e200a971 100644
--- a/lld/test/MachO/link-search-order.s
+++ b/lld/test/MachO/link-search-order.s
@@ -14,37 +14,37 @@
 # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %s -o %t/test.o
 
 ################ default, which is the same as -search_paths_first
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tA -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o \
 # RUN:     --print-dylib-search | FileCheck --check-prefix=ARCHIVESEARCH -DPATH=%t %s
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
 
 ################ Test all permutations of -L%t{A,D} with -search_paths_first
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tA -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tD -L%tA -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tA       -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tD      -L%t -lhello -lgoodbye -lSystem %t/test.o -search_paths_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
 
 ################ Test all permutations of -L%t{A,D} with -search_dylibs_first
-# RUN: env RC_TRACE_DYLIB_SEARCHING=1 %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: env RC_TRACE_DYLIB_SEARCHING=1 %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tA -L%tD -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first \
 # RUN:     | FileCheck --check-prefix=DYLIBSEARCH -DPATH=%t %s
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tD -L%tA -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tA       -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=ARCHIVE %s
-# RUN: %lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
+# RUN: %no-lsystem-lld -L%S/Inputs/MacOSX.sdk/usr/lib -o %t/test -Z \
 # RUN:     -L%tD       -L%t -lhello -lgoodbye -lSystem %t/test.o -search_dylibs_first
 # RUN: llvm-objdump --macho --dylibs-used %t/test | FileCheck --check-prefix=DYLIB %s
 

diff  --git a/lld/test/MachO/lit.local.cfg b/lld/test/MachO/lit.local.cfg
index bfeacfaca087..929160d0c001 100644
--- a/lld/test/MachO/lit.local.cfg
+++ b/lld/test/MachO/lit.local.cfg
@@ -10,7 +10,7 @@ import os
 # flag will append to the set of library roots. As such, we define a separate
 # alias for each platform.
 
-lld_watchos = ('ld64.lld -arch arm64_32 -platform_version watchos 7.0 8.0 -syslibroot ' +
+lld_watchos = ('ld64.lld -lSystem -arch arm64_32 -platform_version watchos 7.0 8.0 -syslibroot ' +
     os.path.join(config.test_source_root, "MachO", "Inputs", "WatchOS.sdk"))
 config.substitutions.append(('%lld-watchos', lld_watchos + ' -fatal_warnings'))
 config.substitutions.append(('%no-fatal-warnings-lld-watchos', lld_watchos))
@@ -21,5 +21,6 @@ config.substitutions.append(('%no-arg-lld', 'ld64.lld'))
 # shortest substitution of "%lld".
 lld = ('ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot ' +
     os.path.join(config.test_source_root, "MachO", "Inputs", "MacOSX.sdk"))
-config.substitutions.append(('%lld', lld + ' -fatal_warnings'))
-config.substitutions.append(('%no-fatal-warnings-lld', lld))
+config.substitutions.append(('%lld', lld + ' -lSystem -fatal_warnings'))
+config.substitutions.append(('%no-lsystem-lld', lld + ' -fatal_warnings'))
+config.substitutions.append(('%no-fatal-warnings-lld', lld + ' -lSystem'))

diff  --git a/lld/test/MachO/local-symbol-output.s b/lld/test/MachO/local-symbol-output.s
index 3fd9458c00a5..ca99d73f8ede 100644
--- a/lld/test/MachO/local-symbol-output.s
+++ b/lld/test/MachO/local-symbol-output.s
@@ -77,6 +77,7 @@
 # RUN: llvm-nm %t/strip_all_export_one.out | FileCheck --check-prefix STRIP-EXP %s
 
 # STRIP-EXP: U _foo
+# STRIP-EXP: U dyld_stub_binder
 # STRIP-EXP-EMPTY:
 
 ## Test interactions of -x and -non_global_symbols_strip_list with unexported_symbol.
@@ -97,6 +98,7 @@
 ## -unexported_symbol made _globby a local, therefore it should be stripped by -x too
 # STRIP-UNEXP: T __mh_execute_header
 # STRIP-UNEXP-DAG: T _main
+# STRIP-UNEXP-DAG: U dyld_stub_binder
 # STRIP-UNEXP-EMPTY:
 
 ## Test interactions of -non_global_symbols_strip_list and unexported_symbol.
@@ -109,6 +111,7 @@
 # NOSTRIP-UNEXP: T __mh_execute_header
 # NOSTRIP-UNEXP-DAG: T _main
 # NOSTRIP-UNEXP-DAG: t _globby
+# NOSTRIP-UNEXP-DAG: U dyld_stub_binder
 # NOSTRIP-UNEXP-EMPTY:
 
 #--- foo.txt
@@ -138,4 +141,4 @@ _main:
   ret
 
  _globby:
-  ret
\ No newline at end of file
+  ret

diff  --git a/lld/test/MachO/map-file.s b/lld/test/MachO/map-file.s
index 8b0585768905..6c381eacfd27 100644
--- a/lld/test/MachO/map-file.s
+++ b/lld/test/MachO/map-file.s
@@ -21,6 +21,7 @@
 # CHECK-NEXT: [[#%x,NUMBER:]] g     O __DATA,__common _number
 # CHECK-NEXT: [[#%x,FOO:]]    g     O __TEXT,obj _foo
 # CHECK-NEXT: [[#%x,HEADER:]] g     F __TEXT,__text __mh_execute_header
+# CHECK-NEXT: [[#%x,HEADER:]] *UND* dyld_stub_binder
 
 # CHECK-NEXT: # Path: {{.*}}{{/|\\}}map-file.s.tmp/test-map
 # CHECK-NEXT: # Arch: x86_64

diff  --git a/lld/test/MachO/search-paths.test b/lld/test/MachO/search-paths.test
index 88f4fabc37b4..57a3ac1d3d8c 100644
--- a/lld/test/MachO/search-paths.test
+++ b/lld/test/MachO/search-paths.test
@@ -1,6 +1,6 @@
 RUN: rm -rf %t1 %t2; mkdir -p %t1 %t2
 
-RUN: %lld -v -dylib -o /dev/null -L%t1 -F%t2 2>&1 \
+RUN: %no-lsystem-lld -v -dylib -o /dev/null -L%t1 -F%t2 2>&1 \
 RUN:     | FileCheck -DLDIR=%t1 -DFDIR=%t2 %s
 CHECK:      Library search paths:
 CHECK-NEXT: [[LDIR]]
@@ -9,7 +9,7 @@ CHECK-NEXT: Framework search paths:
 CHECK-NEXT: [[FDIR]]
 CHECK-NEXT: /System/Library/Frameworks
 
-RUN: %lld -v -dylib -o /dev/null -L%t1 -F%t2 -Z 2>&1 \
+RUN: %no-lsystem-lld -v -dylib -o /dev/null -L%t1 -F%t2 -Z 2>&1 \
 RUN:     | FileCheck -DLDIR=%t1 -DFDIR=%t2 --check-prefix=CHECK_Z %s
 CHECK_Z:      Library search paths:
 CHECK_Z-NEXT: [[LDIR]]


        


More information about the llvm-commits mailing list