Skip to content

Commit 5ee9abd

Browse files
committedMar 6, 2019
ELF: De-template OutputSection::finalize() and MipsGotSection::build(). NFCI.
Differential Revision: https://reviews.llvm.org/D58810 llvm-svn: 355479
1 parent 704dfd6 commit 5ee9abd

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed
 

‎lld/ELF/OutputSections.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ template <class ELFT> void OutputSection::writeTo(uint8_t *Buf) {
263263
writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size);
264264
}
265265

266-
template <class ELFT>
267266
static void finalizeShtGroup(OutputSection *OS,
268267
InputSection *Section) {
269268
assert(Config->Relocatable);
@@ -274,12 +273,11 @@ static void finalizeShtGroup(OutputSection *OS,
274273

275274
// sh_info then contain index of an entry in symbol table section which
276275
// provides signature of the section group.
277-
ObjFile<ELFT> *Obj = Section->getFile<ELFT>();
278-
ArrayRef<Symbol *> Symbols = Obj->getSymbols();
276+
ArrayRef<Symbol *> Symbols = Section->File->getSymbols();
279277
OS->Info = In.SymTab->getSymbolIndex(Symbols[Section->Info]);
280278
}
281279

282-
template <class ELFT> void OutputSection::finalize() {
280+
void OutputSection::finalize() {
283281
if (Type == SHT_NOBITS)
284282
for (BaseCommand *Base : SectionCommands)
285283
if (isa<ByteCommand>(Base))
@@ -298,7 +296,7 @@ template <class ELFT> void OutputSection::finalize() {
298296
}
299297

300298
if (Type == SHT_GROUP) {
301-
finalizeShtGroup<ELFT>(this, First);
299+
finalizeShtGroup(this, First);
302300
return;
303301
}
304302

@@ -428,8 +426,3 @@ template void OutputSection::maybeCompress<ELF32LE>();
428426
template void OutputSection::maybeCompress<ELF32BE>();
429427
template void OutputSection::maybeCompress<ELF64LE>();
430428
template void OutputSection::maybeCompress<ELF64BE>();
431-
432-
template void OutputSection::finalize<ELF32LE>();
433-
template void OutputSection::finalize<ELF32BE>();
434-
template void OutputSection::finalize<ELF64LE>();
435-
template void OutputSection::finalize<ELF64BE>();

‎lld/ELF/OutputSections.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class OutputSection final : public BaseCommand, public SectionBase {
101101
bool ExpressionsUseSymbols = false;
102102
bool InOverlay = false;
103103

104-
template <class ELFT> void finalize();
104+
void finalize();
105105
template <class ELFT> void writeTo(uint8_t *Buf);
106106
template <class ELFT> void maybeCompress();
107107

‎lld/ELF/SyntheticSections.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ bool MipsGotSection::updateAllocSize() {
819819
return false;
820820
}
821821

822-
template <class ELFT> void MipsGotSection::build() {
822+
void MipsGotSection::build() {
823823
if (Gots.empty())
824824
return;
825825

@@ -3192,11 +3192,6 @@ template void PltSection::addEntry<ELF32BE>(Symbol &Sym);
31923192
template void PltSection::addEntry<ELF64LE>(Symbol &Sym);
31933193
template void PltSection::addEntry<ELF64BE>(Symbol &Sym);
31943194

3195-
template void MipsGotSection::build<ELF32LE>();
3196-
template void MipsGotSection::build<ELF32BE>();
3197-
template void MipsGotSection::build<ELF64LE>();
3198-
template void MipsGotSection::build<ELF64BE>();
3199-
32003195
template class elf::MipsAbiFlagsSection<ELF32LE>;
32013196
template class elf::MipsAbiFlagsSection<ELF32BE>;
32023197
template class elf::MipsAbiFlagsSection<ELF64LE>;

‎lld/ELF/SyntheticSections.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class MipsGotSection final : public SyntheticSection {
190190

191191
// Join separate GOTs built for each input file to generate
192192
// primary and optional multiple secondary GOTs.
193-
template <class ELFT> void build();
193+
void build();
194194

195195
void addEntry(InputFile &File, Symbol &Sym, int64_t Addend, RelExpr Expr);
196196
void addDynTlsEntry(InputFile &File, Symbol &Sym);

‎lld/ELF/Writer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
17231723
return;
17241724

17251725
if (In.MipsGot)
1726-
In.MipsGot->build<ELFT>();
1726+
In.MipsGot->build();
17271727

17281728
removeUnusedSyntheticSections();
17291729

@@ -1835,7 +1835,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
18351835
// at the end because some tags like RELSZ depend on result
18361836
// of finalizing other sections.
18371837
for (OutputSection *Sec : OutputSections)
1838-
Sec->finalize<ELFT>();
1838+
Sec->finalize();
18391839
}
18401840

18411841
// Ensure data sections are not mixed with executable sections when

0 commit comments

Comments
 (0)
Please sign in to comment.