[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 12:59:59 PST 2018


ruiu updated this revision to Diff 178770.
ruiu added a comment.

- Review comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55845/new/

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,13 @@
+// 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: ld.lld -o /dev/null -static %t.o %t.so 2>&1 | FileCheck %s
+
+// CHECK: attempted static link of dynamic object
+
+.global _start
+_start:
+  nop
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -224,7 +224,7 @@
     return;
   }
   case file_magic::elf_shared_object:
-    if (Config->Relocatable) {
+    if (Config->Static || Config->Relocatable) {
       error("attempted static link of dynamic object " + Path);
       return;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55845.178770.patch
Type: text/x-patch
Size: 1307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181218/bfb78c5e/attachment.bin>


More information about the llvm-commits mailing list