[lld] r297844 - [ELF] - Split struct In<ELFT> to have templated and non-templated sections areas.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 08:29:29 PDT 2017


Author: grimar
Date: Wed Mar 15 10:29:29 2017
New Revision: 297844

URL: http://llvm.org/viewvc/llvm-project?rev=297844&view=rev
Log:
[ELF] - Split struct In<ELFT> to have templated and non-templated sections areas.

Patch splits In<ELFT> into 2 classes: one for non-templated sections, 
second contains ELFT templated ones.
That allows to code that was detemplated to access non-templated sections freely,
and should open road for futher detemplation proccess.

Differential revision: https://reviews.llvm.org/D30939

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

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=297844&r1=297843&r2=297844&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Mar 15 10:29:29 2017
@@ -2263,6 +2263,18 @@ InputSection *ThunkSection<ELFT>::getTar
   return T->getTargetInputSection();
 }
 
+InputSection *InX::ARMAttributes;
+BssSection *InX::Bss;
+BssSection *InX::BssRelRo;
+InputSection *InX::Common;
+StringTableSection *InX::DynStrTab;
+InputSection *InX::Interp;
+GotPltSection *InX::GotPlt;
+IgotPltSection *InX::IgotPlt;
+MipsRldMapSection *InX::MipsRldMap;
+StringTableSection *InX::ShStrTab;
+StringTableSection *InX::StrTab;
+
 template InputSection *elf::createCommonSection<ELF32LE>();
 template InputSection *elf::createCommonSection<ELF32BE>();
 template InputSection *elf::createCommonSection<ELF64LE>();

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=297844&r1=297843&r2=297844&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Wed Mar 15 10:29:29 2017
@@ -758,14 +758,23 @@ SymbolBody *addSyntheticLocal(StringRef
                               uint64_t Size, InputSectionBase *Section);
 
 // Linker generated sections which can be used as inputs.
-template <class ELFT> struct In {
+struct InX {
   static InputSection *ARMAttributes;
-  static BuildIdSection<ELFT> *BuildId;
   static BssSection *Bss;
   static BssSection *BssRelRo;
   static InputSection *Common;
-  static DynamicSection<ELFT> *Dynamic;
   static StringTableSection *DynStrTab;
+  static InputSection *Interp;
+  static GotPltSection *GotPlt;
+  static IgotPltSection *IgotPlt;
+  static MipsRldMapSection *MipsRldMap;
+  static StringTableSection *ShStrTab;
+  static StringTableSection *StrTab;
+};
+
+template <class ELFT> struct In : public InX {
+  static BuildIdSection<ELFT> *BuildId;
+  static DynamicSection<ELFT> *Dynamic;
   static SymbolTableSection<ELFT> *DynSymTab;
   static EhFrameHeader<ELFT> *EhFrameHdr;
   static GnuHashTableSection<ELFT> *GnuHashTab;
@@ -773,31 +782,20 @@ template <class ELFT> struct In {
   static GotSection<ELFT> *Got;
   static EhFrameSection<ELFT> *EhFrame;
   static MipsGotSection<ELFT> *MipsGot;
-  static GotPltSection *GotPlt;
-  static IgotPltSection *IgotPlt;
   static HashTableSection<ELFT> *HashTab;
-  static InputSection *Interp;
-  static MipsRldMapSection *MipsRldMap;
   static PltSection<ELFT> *Plt;
   static PltSection<ELFT> *Iplt;
   static RelocationSection<ELFT> *RelaDyn;
   static RelocationSection<ELFT> *RelaPlt;
   static RelocationSection<ELFT> *RelaIplt;
-  static StringTableSection *ShStrTab;
-  static StringTableSection *StrTab;
   static SymbolTableSection<ELFT> *SymTab;
   static VersionDefinitionSection<ELFT> *VerDef;
   static VersionTableSection<ELFT> *VerSym;
   static VersionNeedSection<ELFT> *VerNeed;
 };
 
-template <class ELFT> InputSection *In<ELFT>::ARMAttributes;
-template <class ELFT> BssSection *In<ELFT>::Bss;
-template <class ELFT> BssSection *In<ELFT>::BssRelRo;
 template <class ELFT> BuildIdSection<ELFT> *In<ELFT>::BuildId;
-template <class ELFT> InputSection *In<ELFT>::Common;
 template <class ELFT> DynamicSection<ELFT> *In<ELFT>::Dynamic;
-template <class ELFT> StringTableSection *In<ELFT>::DynStrTab;
 template <class ELFT> SymbolTableSection<ELFT> *In<ELFT>::DynSymTab;
 template <class ELFT> EhFrameHeader<ELFT> *In<ELFT>::EhFrameHdr;
 template <class ELFT> GdbIndexSection<ELFT> *In<ELFT>::GdbIndex;
@@ -805,18 +803,12 @@ template <class ELFT> GnuHashTableSectio
 template <class ELFT> GotSection<ELFT> *In<ELFT>::Got;
 template <class ELFT> EhFrameSection<ELFT> *In<ELFT>::EhFrame;
 template <class ELFT> MipsGotSection<ELFT> *In<ELFT>::MipsGot;
-template <class ELFT> GotPltSection *In<ELFT>::GotPlt;
-template <class ELFT> IgotPltSection *In<ELFT>::IgotPlt;
 template <class ELFT> HashTableSection<ELFT> *In<ELFT>::HashTab;
-template <class ELFT> InputSection *In<ELFT>::Interp;
-template <class ELFT> MipsRldMapSection *In<ELFT>::MipsRldMap;
 template <class ELFT> PltSection<ELFT> *In<ELFT>::Plt;
 template <class ELFT> PltSection<ELFT> *In<ELFT>::Iplt;
 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaDyn;
 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaPlt;
 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaIplt;
-template <class ELFT> StringTableSection *In<ELFT>::ShStrTab;
-template <class ELFT> StringTableSection *In<ELFT>::StrTab;
 template <class ELFT> SymbolTableSection<ELFT> *In<ELFT>::SymTab;
 template <class ELFT> VersionDefinitionSection<ELFT> *In<ELFT>::VerDef;
 template <class ELFT> VersionTableSection<ELFT> *In<ELFT>::VerSym;




More information about the llvm-commits mailing list