Skip to content

Commit 8eeede9

Browse files
committed
[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
1 parent 02b9ddb commit 8eeede9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lld/test/MachO/force-load.s

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
# RUN: llvm-objdump --syms %t/test-force-load-second | FileCheck %s --check-prefix=FORCE-LOAD-SECOND
1616
# FORCE-LOAD-SECOND: __TEXT,obj _foo
1717

18+
## If an archive has already been loaded w/o -force_load earlier in the command
19+
## line, a later -force_load argument will not have an effect.
20+
# RUN: %lld -lSystem %t/foo.a -force_load %t/foo.a %t/test.o -o %t/test-regular-then-force
21+
# RUN: llvm-objdump --syms %t/test-regular-then-force | FileCheck %s --check-prefix=REGULAR-THEN-FORCE
22+
# REGULAR-THEN-FORCE-NOT: _foo
23+
## If the -force_load comes first, then the second load will just be a no-op.
24+
# RUN: %lld -lSystem -force_load %t/foo.a %t/foo.a %t/test.o -o %t/test-force-then-regular
25+
# RUN: llvm-objdump --syms %t/test-regular-then-force | FileCheck %s --check-prefix=REGULAR-THEN-FORCE
26+
# FORCE-THEN-REGULAR: _foo
27+
1828
## Force-loading the same path twice is fine
1929
# RUN: %lld -lSystem %t/foo.o -force_load %t/foo.a -force_load %t/foo.a %t/test.o -o /dev/null
2030

0 commit comments

Comments
 (0)