[lld] r297944 - [ELF] - Removed unused templates #4. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 04:20:02 PDT 2017


Author: grimar
Date: Thu Mar 16 06:20:02 2017
New Revision: 297944

URL: http://llvm.org/viewvc/llvm-project?rev=297944&view=rev
Log:
[ELF] - Removed unused templates #4. NFC.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=297944&r1=297943&r2=297944&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Mar 16 06:20:02 2017
@@ -470,7 +470,6 @@ template <class ELFT> void Writer<ELFT>:
     Add(In<ELFT>::StrTab);
 }
 
-template <class ELFT>
 static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName,
                                const SymbolBody &B) {
   if (B.isFile() || B.isSection())
@@ -497,7 +496,7 @@ static bool shouldKeepInSymtab(SectionBa
   return !Sec || !(Sec->Flags & SHF_MERGE);
 }
 
-template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {
+static bool includeInSymtab(const SymbolBody &B) {
   if (!B.isLocal() && !B.symbol()->IsUsedInRegularObj)
     return false;
 
@@ -535,11 +534,11 @@ template <class ELFT> void Writer<ELFT>:
       // No reason to keep local undefined symbol in symtab.
       if (!DR)
         continue;
-      if (!includeInSymtab<ELFT>(*B))
+      if (!includeInSymtab(*B))
         continue;
 
       SectionBase *Sec = DR->Section;
-      if (!shouldKeepInSymtab<ELFT>(Sec, B->getName(), *B))
+      if (!shouldKeepInSymtab(Sec, B->getName(), *B))
         continue;
       In<ELFT>::SymTab->addSymbol(B);
     }
@@ -948,7 +947,6 @@ template <class ELFT> void Writer<ELFT>:
     Sec->assignOffsets();
 }
 
-template <class ELFT>
 static bool canSharePtLoad(const OutputSection &S1, const OutputSection &S2) {
   if (!(S1.Flags & SHF_ALLOC) || !(S2.Flags & SHF_ALLOC))
     return false;
@@ -1011,8 +1009,8 @@ template <class ELFT> void Writer<ELFT>:
   while (NonScriptI != E) {
     auto BestPos = std::max_element(
         I, NonScriptI, [&](OutputSection *&A, OutputSection *&B) {
-          bool ACanSharePtLoad = canSharePtLoad<ELFT>(**NonScriptI, *A);
-          bool BCanSharePtLoad = canSharePtLoad<ELFT>(**NonScriptI, *B);
+          bool ACanSharePtLoad = canSharePtLoad(**NonScriptI, *A);
+          bool BCanSharePtLoad = canSharePtLoad(**NonScriptI, *B);
           if (ACanSharePtLoad != BCanSharePtLoad)
             return BCanSharePtLoad;
 
@@ -1052,7 +1050,6 @@ static void applySynthetic(const std::ve
 // to make them visible from linkescript side. But not all sections are always
 // required to be in output. For example we don't need dynamic section content
 // sometimes. This function filters out such unused sections from output.
-template <class ELFT>
 static void removeUnusedSyntheticSections(std::vector<OutputSection *> &V) {
   // All input synthetic sections that can be empty are placed after
   // all regular ones. We iterate over them all and exit at first
@@ -1119,7 +1116,7 @@ template <class ELFT> void Writer<ELFT>:
   for (Symbol *S : Symtab<ELFT>::X->getSymbols()) {
     SymbolBody *Body = S->body();
 
-    if (!includeInSymtab<ELFT>(*Body))
+    if (!includeInSymtab(*Body))
       continue;
     if (In<ELFT>::SymTab)
       In<ELFT>::SymTab->addSymbol(Body);
@@ -1139,7 +1136,7 @@ template <class ELFT> void Writer<ELFT>:
   // So far we have added sections from input object files.
   // This function adds linker-created Out::* sections.
   addPredefinedSections();
-  removeUnusedSyntheticSections<ELFT>(OutputSections);
+  removeUnusedSyntheticSections(OutputSections);
 
   sortSections();
 
@@ -1265,7 +1262,7 @@ template <class ELFT> OutputSection *Wri
   return nullptr;
 }
 
-template <class ELFT> static bool needsPtLoad(OutputSection *Sec) {
+static bool needsPtLoad(OutputSection *Sec) {
   if (!(Sec->Flags & SHF_ALLOC))
     return false;
 
@@ -1312,7 +1309,7 @@ template <class ELFT> std::vector<PhdrEn
   for (OutputSection *Sec : OutputSections) {
     if (!(Sec->Flags & SHF_ALLOC))
       break;
-    if (!needsPtLoad<ELFT>(Sec))
+    if (!needsPtLoad(Sec))
       continue;
 
     // Segments are contiguous memory regions that has the same attributes
@@ -1346,7 +1343,7 @@ template <class ELFT> std::vector<PhdrEn
   // read-only by dynamic linker after proccessing relocations.
   PhdrEntry RelRo(PT_GNU_RELRO, PF_R);
   for (OutputSection *Sec : OutputSections)
-    if (needsPtLoad<ELFT>(Sec) && isRelroSection<ELFT>(Sec))
+    if (needsPtLoad(Sec) && isRelroSection<ELFT>(Sec))
       RelRo.add(Sec);
   if (RelRo.First)
     Ret.push_back(std::move(RelRo));
@@ -1431,7 +1428,7 @@ template <class ELFT> void Writer<ELFT>:
     if (I == End || (I + 1) == End)
       continue;
     OutputSection *Sec = *(I + 1);
-    if (needsPtLoad<ELFT>(Sec))
+    if (needsPtLoad(Sec))
       Sec->PageAlign = true;
   }
 }
@@ -1510,7 +1507,7 @@ template <class ELFT> void Writer<ELFT>:
       VA = I->second;
 
     // We only assign VAs to allocated sections.
-    if (needsPtLoad<ELFT>(Sec)) {
+    if (needsPtLoad(Sec)) {
       VA = alignTo(VA, Alignment);
       Sec->Addr = VA;
       VA += Sec->Size;




More information about the llvm-commits mailing list