[ELF] - Stop removing sections in removeUnusedSyntheticSections().
That makes code a bit more consistent. Instead of removing sections there
we can just mark them as dead. So that removeEmptyCommands() will
handle the rest.
Differential revision: https://reviews.llvm.org/D38393
llvm-svn: 314654
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 6fc3875..1bbdb01 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -677,6 +677,8 @@
// Try and find an appropriate memory region to assign offsets in.
for (BaseCommand *Base : Opt.Commands) {
if (auto *Sec = dyn_cast<OutputSection>(Base)) {
+ if (!Sec->Live)
+ continue;
Sec->MemRegion = findMemoryRegion(Sec);
// Handle align (e.g. ".foo : ALIGN(16) { ... }").
if (Sec->AlignExpr)
@@ -713,8 +715,6 @@
DefPhdrs = Sec->Phdrs;
}
}
-
- removeEmptyCommands();
}
static OutputSection *findFirstSection(PhdrEntry *Load) {