[lld] r305614 - Error when discarding .dynsym.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 16 16:50:10 PDT 2017
Author: rafael
Date: Fri Jun 16 18:50:09 2017
New Revision: 305614
URL: http://llvm.org/viewvc/llvm-project?rev=305614&view=rev
Log:
Error when discarding .dynsym.
We would crash instead before.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/discard-section-err.s
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=305614&r1=305613&r2=305614&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Fri Jun 16 18:50:09 2017
@@ -338,7 +338,7 @@ LinkerScript::computeInputSections(const
void LinkerScript::discard(ArrayRef<InputSectionBase *> V) {
for (InputSectionBase *S : V) {
S->Live = false;
- if (S == InX::ShStrTab || S == InX::Dynamic)
+ if (S == InX::ShStrTab || S == InX::Dynamic || S == InX::DynSymTab)
error("discarding " + S->Name + " section is not allowed");
discard(S->DependentSections);
}
Modified: lld/trunk/test/ELF/linkerscript/discard-section-err.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/discard-section-err.s?rev=305614&r1=305613&r2=305614&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/discard-section-err.s (original)
+++ lld/trunk/test/ELF/linkerscript/discard-section-err.s Fri Jun 16 18:50:09 2017
@@ -11,3 +11,8 @@
# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
# RUN: FileCheck -check-prefix=DYNAMIC %s
# DYNAMIC: discarding .dynamic section is not allowed
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynsym) } }" > %t.script
+# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
+# RUN: FileCheck -check-prefix=DYNSYM %s
+# DYNSYM: discarding .dynsym section is not allowed
More information about the llvm-commits
mailing list