[lld] r302843 - Reduce templating. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 16:16:43 PDT 2017


Author: rafael
Date: Thu May 11 18:16:43 2017
New Revision: 302843

URL: http://llvm.org/viewvc/llvm-project?rev=302843&view=rev
Log:
Reduce templating. NFC.

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

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=302843&r1=302842&r2=302843&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu May 11 18:16:43 2017
@@ -2245,6 +2245,7 @@ BssSection *InX::Bss;
 BssSection *InX::BssRelRo;
 BuildIdSection *InX::BuildId;
 InputSection *InX::Common;
+SyntheticSection *InX::Dynamic;
 StringTableSection *InX::DynStrTab;
 InputSection *InX::Interp;
 GdbIndexSection *InX::GdbIndex;

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=302843&r1=302842&r2=302843&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Thu May 11 18:16:43 2017
@@ -750,6 +750,7 @@ struct InX {
   static BssSection *BssRelRo;
   static BuildIdSection *BuildId;
   static InputSection *Common;
+  static SyntheticSection *Dynamic;
   static StringTableSection *DynStrTab;
   static InputSection *Interp;
   static GdbIndexSection *GdbIndex;
@@ -764,7 +765,6 @@ struct InX {
 };
 
 template <class ELFT> struct In : public InX {
-  static DynamicSection<ELFT> *Dynamic;
   static SymbolTableSection<ELFT> *DynSymTab;
   static EhFrameHeader<ELFT> *EhFrameHdr;
   static GnuHashTableSection<ELFT> *GnuHashTab;
@@ -780,7 +780,6 @@ template <class ELFT> struct In : public
   static VersionNeedSection<ELFT> *VerNeed;
 };
 
-template <class ELFT> DynamicSection<ELFT> *In<ELFT>::Dynamic;
 template <class ELFT> SymbolTableSection<ELFT> *In<ELFT>::DynSymTab;
 template <class ELFT> EhFrameHeader<ELFT> *In<ELFT>::EhFrameHdr;
 template <class ELFT> GnuHashTableSection<ELFT> *In<ELFT>::GnuHashTab;

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=302843&r1=302842&r2=302843&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu May 11 18:16:43 2017
@@ -429,7 +429,7 @@ RelExpr X86TargetInfo::adjustRelaxExpr(u
 }
 
 void X86TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
-  write32le(Buf, In<ELF32LE>::Dynamic->getVA());
+  write32le(Buf, InX::Dynamic->getVA());
 }
 
 void X86TargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &S) const {
@@ -718,7 +718,7 @@ void X86_64TargetInfo<ELFT>::writeGotPlt
   // required, but it is documented in the psabi and the glibc dynamic linker
   // seems to use it (note that this is relevant for linking ld.so, not any
   // other program).
-  write64le(Buf, In<ELFT>::Dynamic->getVA());
+  write64le(Buf, InX::Dynamic->getVA());
 }
 
 template <class ELFT>

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=302843&r1=302842&r2=302843&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu May 11 18:16:43 2017
@@ -313,7 +313,7 @@ template <class ELFT> void Writer<ELFT>:
   auto Add = [](InputSectionBase *Sec) { InputSections.push_back(Sec); };
 
   InX::DynStrTab = make<StringTableSection>(".dynstr", true);
-  In<ELFT>::Dynamic = make<DynamicSection<ELFT>>();
+  InX::Dynamic = make<DynamicSection<ELFT>>();
   In<ELFT>::RelaDyn = make<RelocationSection<ELFT>>(
       Config->IsRela ? ".rela.dyn" : ".rel.dyn", Config->ZCombreloc);
   InX::ShStrTab = make<StringTableSection>(".shstrtab", false);
@@ -393,7 +393,7 @@ template <class ELFT> void Writer<ELFT>:
       Add(In<ELFT>::HashTab);
     }
 
-    Add(In<ELFT>::Dynamic);
+    Add(InX::Dynamic);
     Add(InX::DynStrTab);
     Add(In<ELFT>::RelaDyn);
   }
@@ -626,7 +626,7 @@ template <class ELFT> bool elf::isRelroS
   // .dynamic section contains data for the dynamic linker, and
   // there's no need to write to it at runtime, so it's better to put
   // it into RELRO.
-  if (Sec == In<ELFT>::Dynamic->OutSec)
+  if (Sec == InX::Dynamic->OutSec)
     return true;
 
   // .bss.rel.ro is used for copy relocations for read-only symbols.
@@ -1110,7 +1110,7 @@ template <class ELFT> void Writer<ELFT>:
   // Even the author of gold doesn't remember why gold behaves that way.
   // https://sourceware.org/ml/binutils/2002-03/msg00360.html
   if (In<ELFT>::DynSymTab)
-    addRegular<ELFT>("_DYNAMIC", In<ELFT>::Dynamic, 0);
+    addRegular<ELFT>("_DYNAMIC", InX::Dynamic, 0);
 
   // Define __rel[a]_iplt_{start,end} symbols if needed.
   addRelIpltSymbols();
@@ -1188,7 +1188,7 @@ template <class ELFT> void Writer<ELFT>:
                   InX::MipsGot,         InX::IgotPlt,       InX::GotPlt,
                   In<ELFT>::RelaDyn,    In<ELFT>::RelaIplt, In<ELFT>::RelaPlt,
                   InX::Plt,             InX::Iplt,          In<ELFT>::EhFrameHdr,
-                  In<ELFT>::VerSym,     In<ELFT>::VerNeed,  In<ELFT>::Dynamic},
+                  In<ELFT>::VerSym,     In<ELFT>::VerNeed,  InX::Dynamic},
                  [](SyntheticSection *SS) { SS->finalizeContents(); });
 
   // Some architectures use small displacements for jump instructions.
@@ -1355,8 +1355,8 @@ template <class ELFT> std::vector<PhdrEn
 
   // Add an entry for .dynamic.
   if (In<ELFT>::DynSymTab)
-    AddHdr(PT_DYNAMIC, In<ELFT>::Dynamic->OutSec->getPhdrFlags())
-        ->add(In<ELFT>::Dynamic->OutSec);
+    AddHdr(PT_DYNAMIC, InX::Dynamic->OutSec->getPhdrFlags())
+        ->add(InX::Dynamic->OutSec);
 
   // PT_GNU_RELRO includes all sections that should be marked as
   // read-only by dynamic linker after proccessing relocations.




More information about the llvm-commits mailing list