[lld] r355479 - ELF: De-template OutputSection::finalize() and MipsGotSection::build(). NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 19:07:58 PST 2019


Author: pcc
Date: Tue Mar  5 19:07:57 2019
New Revision: 355479

URL: http://llvm.org/viewvc/llvm-project?rev=355479&view=rev
Log:
ELF: De-template OutputSection::finalize() and MipsGotSection::build(). NFCI.

Differential Revision: https://reviews.llvm.org/D58810

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=355479&r1=355478&r2=355479&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Mar  5 19:07:57 2019
@@ -263,7 +263,6 @@ template <class ELFT> void OutputSection
       writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size);
 }
 
-template <class ELFT>
 static void finalizeShtGroup(OutputSection *OS,
                              InputSection *Section) {
   assert(Config->Relocatable);
@@ -274,12 +273,11 @@ static void finalizeShtGroup(OutputSecti
 
   // sh_info then contain index of an entry in symbol table section which
   // provides signature of the section group.
-  ObjFile<ELFT> *Obj = Section->getFile<ELFT>();
-  ArrayRef<Symbol *> Symbols = Obj->getSymbols();
+  ArrayRef<Symbol *> Symbols = Section->File->getSymbols();
   OS->Info = In.SymTab->getSymbolIndex(Symbols[Section->Info]);
 }
 
-template <class ELFT> void OutputSection::finalize() {
+void OutputSection::finalize() {
   if (Type == SHT_NOBITS)
     for (BaseCommand *Base : SectionCommands)
       if (isa<ByteCommand>(Base))
@@ -298,7 +296,7 @@ template <class ELFT> void OutputSection
   }
 
   if (Type == SHT_GROUP) {
-    finalizeShtGroup<ELFT>(this, First);
+    finalizeShtGroup(this, First);
     return;
   }
 
@@ -428,8 +426,3 @@ template void OutputSection::maybeCompre
 template void OutputSection::maybeCompress<ELF32BE>();
 template void OutputSection::maybeCompress<ELF64LE>();
 template void OutputSection::maybeCompress<ELF64BE>();
-
-template void OutputSection::finalize<ELF32LE>();
-template void OutputSection::finalize<ELF32BE>();
-template void OutputSection::finalize<ELF64LE>();
-template void OutputSection::finalize<ELF64BE>();

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=355479&r1=355478&r2=355479&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Tue Mar  5 19:07:57 2019
@@ -101,7 +101,7 @@ public:
   bool ExpressionsUseSymbols = false;
   bool InOverlay = false;
 
-  template <class ELFT> void finalize();
+  void finalize();
   template <class ELFT> void writeTo(uint8_t *Buf);
   template <class ELFT> void maybeCompress();
 

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=355479&r1=355478&r2=355479&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Mar  5 19:07:57 2019
@@ -819,7 +819,7 @@ bool MipsGotSection::updateAllocSize() {
   return false;
 }
 
-template <class ELFT> void MipsGotSection::build() {
+void MipsGotSection::build() {
   if (Gots.empty())
     return;
 
@@ -3192,11 +3192,6 @@ template void PltSection::addEntry<ELF32
 template void PltSection::addEntry<ELF64LE>(Symbol &Sym);
 template void PltSection::addEntry<ELF64BE>(Symbol &Sym);
 
-template void MipsGotSection::build<ELF32LE>();
-template void MipsGotSection::build<ELF32BE>();
-template void MipsGotSection::build<ELF64LE>();
-template void MipsGotSection::build<ELF64BE>();
-
 template class elf::MipsAbiFlagsSection<ELF32LE>;
 template class elf::MipsAbiFlagsSection<ELF32BE>;
 template class elf::MipsAbiFlagsSection<ELF64LE>;

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=355479&r1=355478&r2=355479&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Tue Mar  5 19:07:57 2019
@@ -190,7 +190,7 @@ public:
 
   // Join separate GOTs built for each input file to generate
   // primary and optional multiple secondary GOTs.
-  template <class ELFT> void build();
+  void build();
 
   void addEntry(InputFile &File, Symbol &Sym, int64_t Addend, RelExpr Expr);
   void addDynTlsEntry(InputFile &File, Symbol &Sym);

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=355479&r1=355478&r2=355479&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Mar  5 19:07:57 2019
@@ -1723,7 +1723,7 @@ template <class ELFT> void Writer<ELFT>:
     return;
 
   if (In.MipsGot)
-    In.MipsGot->build<ELFT>();
+    In.MipsGot->build();
 
   removeUnusedSyntheticSections();
 
@@ -1835,7 +1835,7 @@ template <class ELFT> void Writer<ELFT>:
   // at the end because some tags like RELSZ depend on result
   // of finalizing other sections.
   for (OutputSection *Sec : OutputSections)
-    Sec->finalize<ELFT>();
+    Sec->finalize();
 }
 
 // Ensure data sections are not mixed with executable sections when




More information about the llvm-commits mailing list