Delete the InterpSection class.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 8 Nov 2016 14:56:27 +0000 (14:56 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 8 Nov 2016 14:56:27 +0000 (14:56 +0000)
We can just use a regular InputSection.

llvm-svn: 286237

lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Writer.cpp

index b612215..5d2c161 100644 (file)
@@ -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::createCommonSection();
 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>;
index 2938819..45a2f34 100644 (file)
 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
index 5084b74..b77f0ea 100644 (file)
@@ -228,7 +228,7 @@ template <class ELFT> void Writer<ELFT>::createSyntheticSections() {
   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;