From: Rui Ueyama Date: Fri, 12 Aug 2016 00:55:08 +0000 (+0000) Subject: Remove OutputSectionBuilder::finalize. X-Git-Tag: llvmorg-4.0.0-rc1~12656 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2de509c370a7af9d51ef9a32e2b4f299b71cc088;p=platform%2Fupstream%2Fllvm.git Remove OutputSectionBuilder::finalize. The reason why we had to assign offsets only to sections that don't contain layout sections were unclear. It turned out that we can live without it. llvm-svn: 278449 --- diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 42b34e3..5fc7e35 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -167,7 +167,6 @@ public: } void flushSymbols(); void flushSection(); - void finalize(); private: OutputSectionFactory &Factory; @@ -236,16 +235,6 @@ template void OutputSectionBuilder::flushSection() { Current = nullptr; } -template void OutputSectionBuilder::finalize() { - // Assign offsets to all sections which don't contain symbols - for (OutputSectionBase *S : *OutputSections) - if (llvm::find_if(OwningSections, - [&](std::unique_ptr> &L) { - return L->OutSec == S; - }) == OwningSections.end()) - S->assignOffsets(); -} - template static bool compareName(InputSectionBase *A, InputSectionBase *B) { return A->getSectionName() < B->getSectionName(); @@ -325,7 +314,6 @@ void LinkerScript::createSections( // Remove from the output all the sections which did not meet // the optional constraints. filter(); - Builder.finalize(); } template @@ -357,11 +345,11 @@ template void LinkerScript::filter() { } template void assignOffsets(OutputSectionBase *Sec) { - // Non-zero size means we have assigned offsets earlier in - // OutputSectionBuilder::finalize auto *OutSec = dyn_cast>(Sec); - if (Sec->getSize() || !OutSec) + if (!OutSec) { + Sec->assignOffsets(); return; + } typedef typename ELFT::uint uintX_t; uintX_t Off = 0; @@ -448,6 +436,7 @@ template void LinkerScript::assignAddresses() { Dot += Sec->getSize(); continue; } + Sec->assignOffsets(); } }