diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -101,7 +101,7 @@ bool ExpressionsUseSymbols = false; bool InOverlay = false; - template void finalize(); + void finalize(); template void writeTo(uint8_t *Buf); template void maybeCompress(); diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -263,7 +263,6 @@ writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size); } -template static void finalizeShtGroup(OutputSection *OS, InputSection *Section) { assert(Config->Relocatable); @@ -274,12 +273,11 @@ // sh_info then contain index of an entry in symbol table section which // provides signature of the section group. - ObjFile *Obj = Section->getFile(); - ArrayRef Symbols = Obj->getSymbols(); + ArrayRef Symbols = Section->File->getSymbols(); OS->Info = In.SymTab->getSymbolIndex(Symbols[Section->Info]); } -template void OutputSection::finalize() { +void OutputSection::finalize() { if (Type == SHT_NOBITS) for (BaseCommand *Base : SectionCommands) if (isa(Base)) @@ -298,7 +296,7 @@ } if (Type == SHT_GROUP) { - finalizeShtGroup(this, First); + finalizeShtGroup(this, First); return; } @@ -428,8 +426,3 @@ template void OutputSection::maybeCompress(); template void OutputSection::maybeCompress(); template void OutputSection::maybeCompress(); - -template void OutputSection::finalize(); -template void OutputSection::finalize(); -template void OutputSection::finalize(); -template void OutputSection::finalize(); diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -190,7 +190,7 @@ // Join separate GOTs built for each input file to generate // primary and optional multiple secondary GOTs. - template void build(); + void build(); void addEntry(InputFile &File, Symbol &Sym, int64_t Addend, RelExpr Expr); void addDynTlsEntry(InputFile &File, Symbol &Sym); diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -819,7 +819,7 @@ return false; } -template void MipsGotSection::build() { +void MipsGotSection::build() { if (Gots.empty()) return; @@ -3192,11 +3192,6 @@ template void PltSection::addEntry(Symbol &Sym); template void PltSection::addEntry(Symbol &Sym); -template void MipsGotSection::build(); -template void MipsGotSection::build(); -template void MipsGotSection::build(); -template void MipsGotSection::build(); - template class elf::MipsAbiFlagsSection; template class elf::MipsAbiFlagsSection; template class elf::MipsAbiFlagsSection; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1723,7 +1723,7 @@ return; if (In.MipsGot) - In.MipsGot->build(); + In.MipsGot->build(); removeUnusedSyntheticSections(); @@ -1835,7 +1835,7 @@ // at the end because some tags like RELSZ depend on result // of finalizing other sections. for (OutputSection *Sec : OutputSections) - Sec->finalize(); + Sec->finalize(); } // Ensure data sections are not mixed with executable sections when