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

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 20:50:41 PDT 2022


Author: Jez Ng
Date: 2022-06-16T23:50:07-04:00
New Revision: 8eeede973c69841082db1b0ee0ceb7ae87813101

URL: https://github.com/llvm/llvm-project/commit/8eeede973c69841082db1b0ee0ceb7ae87813101
DIFF: https://github.com/llvm/llvm-project/commit/8eeede973c69841082db1b0ee0ceb7ae87813101.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/force-load.s b/lld/test/MachO/force-load.s
index 13d65f9f4a159..b513624676154 100644
--- a/lld/test/MachO/force-load.s
+++ b/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
 


        


More information about the llvm-commits mailing list