Linker script: Fix bug with several .bss
When final image has several .bss sections, lld fails
because second .bss always has zero VA. This causes
link error "Not enough space for ELF and program headers"
llvm-svn: 282067
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index a0bffce..3d1af63 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -453,10 +453,11 @@
process(**I);
flush();
for (OutputSectionBase<ELFT> *Base : Sections) {
- if (!AlreadyOutputOS.insert(Base).second)
+ if (AlreadyOutputOS.count(Base))
continue;
switchTo(Base);
Dot += CurOutSec->getSize();
+ flush();
}
std::for_each(E, Cmd->Commands.end(),
[this](std::unique_ptr<BaseCommand> &B) { process(*B.get()); });