[PATCH] D55845: Reject .so files if -static is given.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 18 11:39:31 PST 2018
ruiu created this revision.
ruiu added reviewers: grimar, MaskRay.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Previously, if you pass -static to lld, lld searches for only foo.a
and skips foo.so for -lfoo option. However, it didn't reject .so files
if you directly pass their pathnames via the command line, which is a bug.
https://reviews.llvm.org/D55845
Files:
lld/ELF/Driver.cpp
lld/test/ELF/static-error.s
lld/test/ELF/tls-static.s
Index: lld/test/ELF/tls-static.s
===================================================================
--- lld/test/ELF/tls-static.s
+++ lld/test/ELF/tls-static.s
@@ -4,7 +4,6 @@
// RUN: ld.lld -static %t -o %tout
// RUN: ld.lld %t -o %tout
// RUN: ld.lld -shared %tso -o %tshared
-// RUN: ld.lld -static %t %tshared -o %tout
.global _start
_start:
Index: lld/test/ELF/static-error.s
===================================================================
--- /dev/null
+++ lld/test/ELF/static-error.s
@@ -0,0 +1,14 @@
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/shared.s -o %t.o
+// RUN: ld.lld -shared -o %t.so %t.o
+
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: ld.lld -o /dev/null %t.o %t.so
+// RUN: not ld.lld -o /dev/null -static %t.o %t.so >& %t.log
+// RUN: FileCheck %s < %t.log
+
+// CHECK: cannot mix -static with dynamic object
+
+.global _start
+_start:
+ nop
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -229,6 +229,11 @@
return;
}
+ if (Config->Static) {
+ error("cannot mix -static with dynamic object " + Path);
+ return;
+ }
+
// DSOs usually have DT_SONAME tags in their ELF headers, and the
// sonames are used to identify DSOs. But if they are missing,
// they are identified by filenames. We don't know whether the new
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55845.178745.patch
Type: text/x-patch
Size: 1456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181218/67e872e6/attachment.bin>
More information about the llvm-commits
mailing list