Error on trying to discard .dynamic.
We would crash instead before.
llvm-svn: 305613
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 8c7a1e7..651acea 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -338,8 +338,8 @@
void LinkerScript::discard(ArrayRef<InputSectionBase *> V) {
for (InputSectionBase *S : V) {
S->Live = false;
- if (S == InX::ShStrTab)
- error("discarding .shstrtab section is not allowed");
+ if (S == InX::ShStrTab || S == InX::Dynamic)
+ error("discarding " + S->Name + " section is not allowed");
discard(S->DependentSections);
}
}