[lld] 4225444 - [lld/mac] Add a test for -reexport_library + -dead_strip_dylibs
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 7 10:45:21 PDT 2021
Author: Nico Weber
Date: 2021-06-07T13:44:58-04:00
New Revision: 422544414b0dd79fef2f10a051b22c47ae5a0af1
URL: https://github.com/llvm/llvm-project/commit/422544414b0dd79fef2f10a051b22c47ae5a0af1
DIFF: https://github.com/llvm/llvm-project/commit/422544414b0dd79fef2f10a051b22c47ae5a0af1.diff
LOG: [lld/mac] Add a test for -reexport_library + -dead_strip_dylibs
Our behavior here already matched ld64, now we have a test for it.
(ld64 even strips the library here if you also pass -needed_library bar.dylib.
That seems wrong to me, and lld honors needed_library in that case.)
Differential Revision: https://reviews.llvm.org/D103812
Added:
Modified:
lld/test/MachO/dead-strip-dylibs.s
Removed:
################################################################################
diff --git a/lld/test/MachO/dead-strip-dylibs.s b/lld/test/MachO/dead-strip-dylibs.s
index 4ea5041c59d6c..ca3ad06a7493a 100644
--- a/lld/test/MachO/dead-strip-dylibs.s
+++ b/lld/test/MachO/dead-strip-dylibs.s
@@ -46,6 +46,14 @@
# NOBARSTRIP: foo.dylib
# NOBARSTRIP-NOT: bar-strip.dylib
+## Even libraries explicitly reexported with -reexport_library are stripped
+## if they are not referenced.
+# RUN: %lld -lSystem %t/main.o -o %t/main %t/foo_with_bar.dylib \
+# RUN: -reexport_library %t/bar.dylib -dead_strip_dylibs
+# RUN: llvm-otool -L %t/main | FileCheck --check-prefix=NOBAR %s
+# RUN: llvm-otool -l %t/main | FileCheck --check-prefix=NOREEXPORT %s
+# NOREEXPORT-NOT: LC_REEXPORT_DYLIB
+
## But -needed_library and -needed-l win over -dead_strip_dylibs again.
# RUN: %lld -lSystem %t/main.o -o %t/main %t/foo_with_bar.dylib \
# RUN: -needed_library %t/bar.dylib -dead_strip_dylibs
More information about the llvm-commits
mailing list