[PATCH] D41143: Fix the type of the Discared section

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 17:37:10 PST 2017


rafael updated this revision to Diff 126661.
rafael added a comment.

Use existing constructor.


https://reviews.llvm.org/D41143

Files:
  ELF/InputSection.cpp
  ELF/InputSection.h


Index: ELF/InputSection.h
===================================================================
--- ELF/InputSection.h
+++ ELF/InputSection.h
@@ -85,12 +85,6 @@
 // This corresponds to a section of an input file.
 class InputSectionBase : public SectionBase {
 public:
-  InputSectionBase()
-      : SectionBase(Regular, "", /*Flags*/ 0, /*Entsize*/ 0, /*Alignment*/ 0,
-                    /*Type*/ 0,
-                    /*Info*/ 0, /*Link*/ 0),
-        NumRelocations(0), AreRelocsRela(false), Repl(this) {}
-
   template <class ELFT>
   InputSectionBase(ObjFile<ELFT> *File, const typename ELFT::Shdr *Header,
                    StringRef Name, Kind SectionKind);
@@ -114,8 +108,6 @@
   ArrayRef<uint8_t> Data;
   uint64_t getOffsetInFile() const;
 
-  static InputSectionBase Discarded;
-
   // True if this section has already been placed to a linker script
   // output section. This is needed because, in a linker script, you
   // can refer to the same section more than once. For example, in
@@ -337,6 +329,8 @@
   // Called by ICF to merge two input sections.
   void replace(InputSection *Other);
 
+  static InputSection Discarded;
+
 private:
   template <class ELFT, class RelTy>
   void copyRelocations(uint8_t *Buf, llvm::ArrayRef<RelTy> Rels);
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -323,7 +323,7 @@
       .str();
 }
 
-InputSectionBase InputSectionBase::Discarded;
+InputSection InputSection::Discarded(0, 0, 0, ArrayRef<uint8_t>(), "");
 
 InputSection::InputSection(uint64_t Flags, uint32_t Type, uint32_t Alignment,
                            ArrayRef<uint8_t> Data, StringRef Name, Kind K)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41143.126661.patch
Type: text/x-patch
Size: 1726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171213/43354811/attachment.bin>


More information about the llvm-commits mailing list