[lld] r316622 - Unassign sections if they are "assigned" to /DISCARD/.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 15:03:21 PDT 2017
Author: ruiu
Date: Wed Oct 25 15:03:21 2017
New Revision: 316622
URL: http://llvm.org/viewvc/llvm-project?rev=316622&view=rev
Log:
Unassign sections if they are "assigned" to /DISCARD/.
"/DISCARD/" is a special section name in the linker script to discard
input sections. Previously, we handled it as if it were a real section,
so an input section can be assigned but dead. However, allowing sections
to be
- assigned and alive (will be emitted),
- not assigned and dead (removed), or
- assigned but dead (???)
feels logically wrong and practically error-prone. This patch removes
the last combination of the states.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=316622&r1=316621&r2=316622&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Oct 25 15:03:21 2017
@@ -318,10 +318,12 @@ LinkerScript::computeInputSections(const
void LinkerScript::discard(ArrayRef<InputSection *> V) {
for (InputSection *S : V) {
- S->Live = false;
if (S == InX::ShStrTab || S == InX::Dynamic || S == InX::DynSymTab ||
S == InX::DynStrTab)
error("discarding " + S->Name + " section is not allowed");
+
+ S->Assigned = false;
+ S->Live = false;
discard(S->DependentSections);
}
}
More information about the llvm-commits
mailing list