From 5ee9abd4c80ba45326843fdbc296f0b5d6b78fba Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 6 Mar 2019 03:07:57 +0000 Subject: [PATCH] ELF: De-template OutputSection::finalize() and MipsGotSection::build(). NFCI. Differential Revision: https://reviews.llvm.org/D58810 llvm-svn: 355479 --- lld/ELF/OutputSections.cpp | 13 +++---------- lld/ELF/OutputSections.h | 2 +- lld/ELF/SyntheticSections.cpp | 7 +------ lld/ELF/SyntheticSections.h | 2 +- lld/ELF/Writer.cpp | 4 ++-- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 96be5a1..8614a60 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -263,7 +263,6 @@ template void OutputSection::writeTo(uint8_t *Buf) { writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size); } -template static void finalizeShtGroup(OutputSection *OS, InputSection *Section) { assert(Config->Relocatable); @@ -274,12 +273,11 @@ static void finalizeShtGroup(OutputSection *OS, // 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 @@ template void OutputSection::finalize() { } 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::maybeCompress(); - -template void OutputSection::finalize(); -template void OutputSection::finalize(); -template void OutputSection::finalize(); -template void OutputSection::finalize(); diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 275b72f..3a76607 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -101,7 +101,7 @@ public: 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/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index d5514f6..a31ef9a 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -819,7 +819,7 @@ bool MipsGotSection::updateAllocSize() { 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 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/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 93a723f..d160d3a 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -190,7 +190,7 @@ public: // 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/Writer.cpp b/lld/ELF/Writer.cpp index 5703a63..705ce0f 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1723,7 +1723,7 @@ template void Writer::finalizeSections() { return; if (In.MipsGot) - In.MipsGot->build(); + In.MipsGot->build(); removeUnusedSyntheticSections(); @@ -1835,7 +1835,7 @@ template void Writer::finalizeSections() { // 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 -- 2.7.4