[lld] r320539 - Fix the type of the Discared section.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 17:39:35 PST 2017


Author: rafael
Date: Tue Dec 12 17:39:35 2017
New Revision: 320539

URL: http://llvm.org/viewvc/llvm-project?rev=320539&view=rev
Log:
Fix the type of the Discared section.

It is constructed with a kind of Regular and will dyn_cast to
InputSection, but is declared to be an InputSectionBase.

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

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=320539&r1=320538&r2=320539&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Dec 12 17:39:35 2017
@@ -323,7 +323,7 @@ std::string InputSectionBase::getObjMsg(
       .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)

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=320539&r1=320538&r2=320539&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Tue Dec 12 17:39:35 2017
@@ -85,12 +85,6 @@ protected:
 // 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 @@ public:
   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 @@ public:
   // 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);




More information about the llvm-commits mailing list