diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index ecbca4564e0c..4549dfd6f9ad 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -162,10 +162,9 @@ uint64_t SectionBase::getOffset(const DefinedRegular &Sym) const { return getOffset(Sym.Value); } -template InputSectionBase *InputSectionBase::getLinkOrderDep() const { if ((Flags & SHF_LINK_ORDER) && Link != 0) - return getFile()->getSections()[Link]; + return File->getSections()[Link]; return nullptr; } @@ -830,11 +829,6 @@ template void InputSectionBase::uncompress(); template void InputSectionBase::uncompress(); template void InputSectionBase::uncompress(); -template InputSectionBase *InputSectionBase::getLinkOrderDep() const; -template InputSectionBase *InputSectionBase::getLinkOrderDep() const; -template InputSectionBase *InputSectionBase::getLinkOrderDep() const; -template InputSectionBase *InputSectionBase::getLinkOrderDep() const; - template InputSectionBase *InputSection::getRelocatedSection(); template InputSectionBase *InputSection::getRelocatedSection(); template InputSectionBase *InputSection::getRelocatedSection(); diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index 4a5b1af56c3e..f54ddbb89aab 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -157,7 +157,7 @@ public: return getFile()->getObj(); } - template InputSectionBase *getLinkOrderDep() const; + InputSectionBase *getLinkOrderDep() const; template void uncompress(); diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 4840a6afef87..be17d96151ac 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -69,14 +69,13 @@ OutputSection::OutputSection(StringRef Name, uint32_t Type, uint64_t Flags) /*Info*/ 0, /*Link*/ 0) {} -template static bool compareByFilePosition(InputSection *A, InputSection *B) { // Synthetic doesn't have link order dependecy, stable_sort will keep it last if (A->kind() == InputSectionBase::Synthetic || B->kind() == InputSectionBase::Synthetic) return false; - auto *LA = cast(A->template getLinkOrderDep()); - auto *LB = cast(B->template getLinkOrderDep()); + auto *LA = cast(A->getLinkOrderDep()); + auto *LB = cast(B->getLinkOrderDep()); OutputSection *AOut = LA->OutSec; OutputSection *BOut = LB->OutSec; if (AOut != BOut) @@ -86,14 +85,14 @@ static bool compareByFilePosition(InputSection *A, InputSection *B) { template void OutputSection::finalize() { if ((this->Flags & SHF_LINK_ORDER) && !this->Sections.empty()) { - std::sort(Sections.begin(), Sections.end(), compareByFilePosition); + std::sort(Sections.begin(), Sections.end(), compareByFilePosition); assignOffsets(); // We must preserve the link order dependency of sections with the // SHF_LINK_ORDER flag. The dependency is indicated by the sh_link field. We // need to translate the InputSection sh_link to the OutputSection sh_link, // all InputSections in the OutputSection have the same dependency. - if (auto *D = this->Sections.front()->template getLinkOrderDep()) + if (auto *D = this->Sections.front()->getLinkOrderDep()) this->Link = D->OutSec->SectionIndex; } diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 890a60d2950c..4b80b6bce9a6 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2196,7 +2196,7 @@ void ARMExidxSentinelSection::writeTo(uint8_t *Buf) { // Get the InputSection before us, we are by definition last auto RI = cast(this->OutSec)->Sections.rbegin(); InputSection *LE = *(++RI); - InputSection *LC = cast(LE->template getLinkOrderDep()); + InputSection *LC = cast(LE->getLinkOrderDep()); uint64_t S = LC->OutSec->Addr + LC->getOffset(LC->getSize()); uint64_t P = this->getVA(); Target->relocateOne(Buf, R_ARM_PREL31, S - P);