[lld-macho][nfc] Tests for -force_load + regular archive load combinations

I realized we'd forgotten to cover this case (though our existing
behavior is indeed correct / matches ld64's).

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D128025
This commit is contained in:
Jez Ng 2022-06-16 23:49:11 -04:00
parent 02b9ddb2f2
commit 8eeede973c
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,16 @@
# RUN: llvm-objdump --syms %t/test-force-load-second | FileCheck %s --check-prefix=FORCE-LOAD-SECOND # RUN: llvm-objdump --syms %t/test-force-load-second | FileCheck %s --check-prefix=FORCE-LOAD-SECOND
# FORCE-LOAD-SECOND: __TEXT,obj _foo # FORCE-LOAD-SECOND: __TEXT,obj _foo
## If an archive has already been loaded w/o -force_load earlier in the command
## line, a later -force_load argument will not have an effect.
# RUN: %lld -lSystem %t/foo.a -force_load %t/foo.a %t/test.o -o %t/test-regular-then-force
# RUN: llvm-objdump --syms %t/test-regular-then-force | FileCheck %s --check-prefix=REGULAR-THEN-FORCE
# REGULAR-THEN-FORCE-NOT: _foo
## If the -force_load comes first, then the second load will just be a no-op.
# RUN: %lld -lSystem -force_load %t/foo.a %t/foo.a %t/test.o -o %t/test-force-then-regular
# RUN: llvm-objdump --syms %t/test-regular-then-force | FileCheck %s --check-prefix=REGULAR-THEN-FORCE
# FORCE-THEN-REGULAR: _foo
## Force-loading the same path twice is fine ## Force-loading the same path twice is fine
# RUN: %lld -lSystem %t/foo.o -force_load %t/foo.a -force_load %t/foo.a %t/test.o -o /dev/null # RUN: %lld -lSystem %t/foo.o -force_load %t/foo.a -force_load %t/foo.a %t/test.o -o /dev/null