We have a mix of substituted lld (`%lld`) and hard-coded lld (`ld64.lld`) commands.
When testing with different versions of LLD, this would require going into every place
where lld is hard-coded and changing that. If we centralize it, this'll only require us
to modify it in only one place and will make it easy to run the same test suite. Plus,
this will make it be consistent with how we write other tests.
Reviewed By: #lld-macho, int3, oontvoo
Differential Revision: https://reviews.llvm.org/D119394
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk -lSystem
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk -lSystem
# RUN: llvm-objdump --macho --all-headers %t/out | FileCheck --check-prefix=NO-ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -o %t/out %t/foo-arm64-sim.o
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -o %t/out %t/foo-arm64-sim.o
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -adhoc_codesign -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk -lSystem
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -adhoc_codesign -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk -lSystem
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -adhoc_codesign -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -adhoc_codesign -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: ld64.lld -lSystem -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -no_adhoc_codesign -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk
+# RUN: %no-arg-lld -lSystem -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -no_adhoc_codesign -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -no_adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -no_adhoc_codesign -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -no_adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: %no-arg-lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -no_adhoc_codesign -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
# ADHOC: cmd LC_CODE_SIGNATURE
# RUN: mkdir -p %t
#
# RUN: llvm-mc -filetype obj -triple x86_64-apple-ios %s -o %t/test.o
-# RUN: not ld64.lld -arch x86_64 -platform_version ios 14.0 15.0 -o %t/test \
+# RUN: not %no-arg-lld -arch x86_64 -platform_version ios 14.0 15.0 -o %t/test \
# RUN: -syslibroot %S/../Inputs/iPhoneSimulator.sdk -lSystem %t/test.o 2>&1 | FileCheck %s
# CHECK-DAG: error: undefined symbol: __cache_handle_memory_pressure_event
config.substitutions.append(('%lld-watchos', lld_watchos + ' -fatal_warnings'))
config.substitutions.append(('%no_fatal_warnings_lld-watchos', lld_watchos))
+config.substitutions.append(('%no-arg-lld', 'ld64.lld'))
+
# Since most of our tests are written around x86_64, we give this platform the
# shortest substitution of "%lld".
lld = ('ld64.lld -arch x86_64 -platform_version macos 10.15 11.0 -syslibroot ' +
# RUN: FileCheck %s --check-prefix=VERSION < repro1/version.txt
# VERSION: LLD
-# RUN: cd repro1; ld64.lld @response.txt
+# RUN: cd repro1; %no-arg-lld @response.txt
# RUN: mkdir -p %t.dir/build2/a/b/c
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/build2/foo.o
# RSP2-NOT: {{^}}repro2{{[/\\]}}
# RSP2: {{[/\\]}}foo.o
-# RUN: cd repro2; ld64.lld @response.txt
+# RUN: cd repro2; %no-arg-lld @response.txt
.globl _main
_main:
## Test our various file-loading flags to make sure all bases are covered.
# RUN: %lld --reproduce %t/repro1.tar -lSystem -syslibroot %t %t/foo.a %t/bar.a %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"
# RUN: tar xf %t/repro1.tar -C %t
-# RUN: cd %t/repro1; ld64.lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
+# RUN: cd %t/repro1; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
# RUN: %lld --reproduce %t/repro2.tar -lSystem -syslibroot %t -force_load %t/foo.a -force_load %t/bar.a %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"
# RUN: tar xf %t/repro2.tar -C %t
-# RUN: cd %t/repro2; ld64.lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
+# RUN: cd %t/repro2; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
# RUN: %lld --reproduce %t/repro3.tar -lSystem -syslibroot %t %t/libfoo.dylib %t/libbar.dylib %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"
# RUN: tar xf %t/repro3.tar -C %t
-# RUN: cd %t/repro3; ld64.lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
+# RUN: cd %t/repro3; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
# RUN: %lld --reproduce %t/repro4.tar -lSystem -syslibroot %t -weak_library %t/libfoo.dylib -weak_library %t/libbar.dylib %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"
# RUN: tar xf %t/repro4.tar -C %t
-# RUN: cd %t/repro4; ld64.lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
+# RUN: cd %t/repro4; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
# RUN: echo "%t/libfoo.dylib" > %t/filelist
# RUN: echo "%t/libbar.dylib" >> %t/filelist
# RUN: %lld --reproduce %t/repro5.tar -lSystem -syslibroot %t -filelist %t/filelist %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"
# RUN: tar xf %t/repro5.tar -C %t
-# RUN: cd %t/repro5; ld64.lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
+# RUN: cd %t/repro5; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"
## The {{^}} ensures that we only match relative paths if DIR is relative.
# CHECK: {{^}}[[DIR]]/{{(lib)?}}bar
# RUN: FileCheck %s --check-prefix=UNDEF < %t/error
# RUN: tar xf %t/repro6.tar -C %t
-# RUN: cd %t/repro6; not ld64.lld @response.txt 2> %t/error | FileCheck %s -DDIR="%:t/%:t" --check-prefix=FOO
+# RUN: cd %t/repro6; not %no-arg-lld @response.txt 2> %t/error | FileCheck %s -DDIR="%:t/%:t" --check-prefix=FOO
# RUN: FileCheck %s --check-prefix=UNDEF < %t/error
# FOO: [[DIR]]/libfoo.dylib
RUN: mkdir -p %t1 %t2
-RUN: not ld64.lld -arch x86_64 -platform_version macos 10.5 11.0 -v -L%t1 -F%t2 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 %s
+RUN: not %no-arg-lld -arch x86_64 -platform_version macos 10.5 11.0 -v -L%t1 -F%t2 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 %s
CHECK: Library search paths:
CHECK-NEXT: [[LDIR]]
CHECK-NEXT: /usr/lib
CHECK-NEXT: /Library/Frameworks
CHECK-NEXT: /System/Library/Frameworks
-RUN: not ld64.lld -arch x86_64 -platform_version macos 10.5 11.0 -v -L%t1 -F%t2 -Z 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 --check-prefix=CHECK_Z %s
+RUN: not %no-arg-lld -arch x86_64 -platform_version macos 10.5 11.0 -v -L%t1 -F%t2 -Z 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 --check-prefix=CHECK_Z %s
CHECK_Z: Library search paths:
CHECK_Z-NEXT: [[LDIR]]
CHECK_Z-NEXT: Framework search paths:
# REQUIRES: x86, aarch64
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-iossimulator %s -o %t.o
## This should succeed even though libsystem_kernel.dylib has a mismatched platform.
-# RUN: ld64.lld -lSystem -arch x86_64 -platform_version ios-simulator 14.0 15.0 \
+# RUN: %no-arg-lld -lSystem -arch x86_64 -platform_version ios-simulator 14.0 15.0 \
# RUN: -syslibroot %S/Inputs/iPhoneSimulator.sdk %t.o -o %t
# RUN: llvm-objdump --macho --bind %t | FileCheck %s
# CHECK: __DATA_CONST __got 0x100001000 pointer 0 libSystem dyld_stub_binder
# Ensure that a nonexistent path is ignored with a syslibroot
# Don't use %lld to not pick up the default syslibroot flag.
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot /var/empty 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-NONEXISTENT-SYSLIBROOT
CHECK-NONEXISTENT-SYSLIBROOT-NEXT: Framework search paths:
RUN: mkdir -p %t/usr/lib
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-SYSLIBROOT -DROOT=%t
CHECK-SYSLIBROOT-NEXT: [[ROOT]]/usr/lib
RUN: mkdir -p %t/Library/libxml2-development
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t -L /Library/libxml2-development 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-ABSOLUTE-PATH-REROOTED -DROOT=%t
CHECK-ABSOLUTE-PATH-REROOTED: [[ROOT]]/Library/libxml2-development
CHECK-ABSOLUTE-PATH-REROOTED: [[ROOT]]/usr/lib
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t -L %t/Library/libxml2-development 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-PATH-WITHOUT-REROOT -DPATH=%t/Library/libxml2-development
CHECK-PATH-WITHOUT-REROOT: Library search paths:
CHECK-PATH-WITHOUT-REROOT-NEXT: [[PATH]]
RUN: mkdir -p %t.2/usr/lib
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t -syslibroot %t.2 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-SYSLIBROOT-MATRIX -DROOT=%t
CHECK-SYSLIBROOT-MATRIX: [[ROOT]]/usr/lib
CHECK-SYSLIBROOT-MATRIX: [[ROOT]].2/usr/lib
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t -syslibroot %t.2 -syslibroot / 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-SYSLIBROOT-IGNORED -DROOT=%t
CHECK-SYSLIBROOT-IGNORED-NOT: [[ROOT]].2/usr/lib
RUN: mkdir -p %t/System/Library/Frameworks
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-SYSLIBROOT-FRAMEWORK -DROOT=%t
RUN: mkdir -p %t/Library/Frameworks
RUN: mkdir -p %t.2/Library/Frameworks
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t -syslibroot %t.2 \
RUN: -F /Library/Frameworks 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-SYSLIBROOT-FRAMEWORK-MATRIX -DROOT=%t
CHECK-SYSLIBROOT-FRAMEWORK-MATRIX: [[ROOT]]/Library/Frameworks
CHECK-SYSLIBROOT-FRAMEWORK-MATRIX: [[ROOT]].2/Library/Frameworks
-RUN: ld64.lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
+RUN: %no-arg-lld -arch x86_64 -platform_version macos 10 11 -v -dylib \
RUN: -o /dev/null -syslibroot %t -syslibroot %t.2 -syslibroot / \
RUN: -F /Library/Frameworks 2>&1 \
RUN: | FileCheck %s -check-prefix CHECK-SYSLIBROOT-FRAMEWORK-IGNORED -DROOT=%t