[lld] r286237 - Delete the InterpSection class.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 06:56:28 PST 2016


Author: rafael
Date: Tue Nov  8 08:56:27 2016
New Revision: 286237

URL: http://llvm.org/viewvc/llvm-project?rev=286237&view=rev
Log:
Delete the InterpSection class.

We can just use a regular InputSection.

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

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=286237&r1=286236&r2=286237&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Nov  8 08:56:27 2016
@@ -82,11 +82,11 @@ static ArrayRef<uint8_t> createInterp()
   return {(const uint8_t *)S.data(), S.size() + 1};
 }
 
-template <class ELFT>
-InterpSection<ELFT>::InterpSection()
-    : InputSection<ELFT>(SHF_ALLOC, SHT_PROGBITS, 1, createInterp(),
-                         ".interp") {
-  this->Live = true;
+template <class ELFT> InputSection<ELFT> *elf::createInterpSection() {
+  auto *Ret = make<InputSection<ELFT>>(SHF_ALLOC, SHT_PROGBITS, 1,
+                                       createInterp(), ".interp");
+  Ret->Live = true;
+  return Ret;
 }
 
 template <class ELFT>
@@ -193,10 +193,10 @@ template InputSection<ELF32BE> *elf::cre
 template InputSection<ELF64LE> *elf::createCommonSection();
 template InputSection<ELF64BE> *elf::createCommonSection();
 
-template class elf::InterpSection<ELF32LE>;
-template class elf::InterpSection<ELF32BE>;
-template class elf::InterpSection<ELF64LE>;
-template class elf::InterpSection<ELF64BE>;
+template InputSection<ELF32LE> *elf::createInterpSection();
+template InputSection<ELF32BE> *elf::createInterpSection();
+template InputSection<ELF64LE> *elf::createInterpSection();
+template InputSection<ELF64BE> *elf::createInterpSection();
 
 template class elf::BuildIdSection<ELF32LE>;
 template class elf::BuildIdSection<ELF32BE>;

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=286237&r1=286236&r2=286237&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Tue Nov  8 08:56:27 2016
@@ -15,12 +15,6 @@
 namespace lld {
 namespace elf {
 
-// .interp section.
-template <class ELFT> class InterpSection final : public InputSection<ELFT> {
-public:
-  InterpSection();
-};
-
 // .note.gnu.build-id section.
 template <class ELFT> class BuildIdSection : public InputSection<ELFT> {
 public:
@@ -73,17 +67,18 @@ public:
 };
 
 template <class ELFT> InputSection<ELFT> *createCommonSection();
+template <class ELFT> InputSection<ELFT> *createInterpSection();
 
 // Linker generated sections which can be used as inputs.
 template <class ELFT> struct In {
   static BuildIdSection<ELFT> *BuildId;
   static InputSection<ELFT> *Common;
-  static InterpSection<ELFT> *Interp;
+  static InputSection<ELFT> *Interp;
 };
 
 template <class ELFT> BuildIdSection<ELFT> *In<ELFT>::BuildId;
 template <class ELFT> InputSection<ELFT> *In<ELFT>::Common;
-template <class ELFT> InterpSection<ELFT> *In<ELFT>::Interp;
+template <class ELFT> InputSection<ELFT> *In<ELFT>::Interp;
 
 } // namespace elf
 } // namespace lld

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=286237&r1=286236&r2=286237&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Nov  8 08:56:27 2016
@@ -228,7 +228,7 @@ template <class ELFT> void Writer<ELFT>:
   Out<ELFT>::ProgramHeaders->updateAlignment(sizeof(uintX_t));
 
   if (needsInterpSection<ELFT>()) {
-    In<ELFT>::Interp = make<InterpSection<ELFT>>();
+    In<ELFT>::Interp = createInterpSection<ELFT>();
     Symtab<ELFT>::X->Sections.push_back(In<ELFT>::Interp);
   } else {
     In<ELFT>::Interp = nullptr;




More information about the llvm-commits mailing list