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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 20:22:14 PDT 2022


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128025

Files:
  lld/test/MachO/force-load.s


Index: lld/test/MachO/force-load.s
===================================================================
--- lld/test/MachO/force-load.s
+++ lld/test/MachO/force-load.s
@@ -15,6 +15,16 @@
 # RUN: llvm-objdump --syms %t/test-force-load-second | FileCheck %s --check-prefix=FORCE-LOAD-SECOND
 # 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
 # RUN: %lld -lSystem %t/foo.o -force_load %t/foo.a -force_load %t/foo.a %t/test.o -o /dev/null
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128025.437782.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220617/6f938a35/attachment.bin>


More information about the llvm-commits mailing list