diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index ce25625fd768..8e6b4c5eef8d 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -65,7 +65,6 @@ private: bool isOutputDynamic() const { return !Symtab.getSharedFiles().empty() || Config->Shared; } - bool needsDynamicSections() const { return isOutputDynamic(); } uintX_t getVAStart() const { return Config->Shared ? 0 : Target->getVAStart(); } std::unique_ptr Buffer; @@ -435,13 +434,13 @@ template void Writer::createSections() { continue; Out::SymTab->addSymbol(Name); - if (needsDynamicSections() && includeInDynamicSymtab(*Body)) + if (isOutputDynamic() && includeInDynamicSymtab(*Body)) Out::HashTab->addSymbol(Body); } addCommonSymbols(CommonSymbols); OutputSections.push_back(Out::SymTab); - if (needsDynamicSections()) { + if (isOutputDynamic()) { OutputSections.push_back(Out::DynSymTab); OutputSections.push_back(Out::HashTab); OutputSections.push_back(Out::Dynamic); @@ -495,7 +494,7 @@ template void Writer::assignAddresses() { int NumPhdrs = 2; // 2 for PhdrPhdr and FileHeaderPhdr if (needsInterpSection()) ++NumPhdrs; - if (needsDynamicSections()) + if (isOutputDynamic()) ++NumPhdrs; uintX_t Last = PF_R; for (OutputSectionBase *Sec : OutputSections) { @@ -570,7 +569,7 @@ template void Writer::assignAddresses() { Interp->p_type = PT_INTERP; copyPhdr(Interp, Out::Interp); } - if (needsDynamicSections()) { + if (isOutputDynamic()) { Phdrs.emplace_back(); Elf_Phdr *PH = &Phdrs.back(); PH->p_type = PT_DYNAMIC;