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 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/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: