[lld] r286379 - Make Discarded a InputSection.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 9 08:55:07 PST 2016
Author: rafael
Date: Wed Nov 9 10:55:07 2016
New Revision: 286379
URL: http://llvm.org/viewvc/llvm-project?rev=286379&view=rev
Log:
Make Discarded a InputSection.
It was quite confusing that it had SectionKind of Regular, but was not
actually a InputSection.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/InputSection.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=286379&r1=286378&r2=286379&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Nov 9 10:55:07 2016
@@ -446,7 +446,7 @@ elf::ObjectFile<ELFT>::getSection(const
fatal(getFilename(this) + ": invalid section index: " + Twine(Index));
}
- if (S == &InputSectionBase<ELFT>::Discarded)
+ if (S == &InputSection<ELFT>::Discarded)
return S;
return S->Repl;
}
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=286379&r1=286378&r2=286379&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Nov 9 10:55:07 2016
@@ -190,6 +190,9 @@ InputSectionBase<ELFT> *InputSectionBase
}
template <class ELFT>
+InputSection<ELFT>::InputSection() : InputSectionBase<ELFT>() {}
+
+template <class ELFT>
InputSection<ELFT>::InputSection(uintX_t Flags, uint32_t Type,
uintX_t Addralign, ArrayRef<uint8_t> Data,
StringRef Name)
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=286379&r1=286378&r2=286379&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Nov 9 10:55:07 2016
@@ -116,8 +116,6 @@ public:
// Returns the size of this section (even if this is a common or BSS.)
size_t getSize() const;
- static InputSectionBase<ELFT> Discarded;
-
ObjectFile<ELFT> *getFile() const { return File; }
llvm::object::ELFFile<ELFT> getObj() const { return File->getObj(); }
uintX_t getOffset(const DefinedRegular<ELFT> &Sym) const;
@@ -138,8 +136,6 @@ private:
getRawCompressedData(ArrayRef<uint8_t> Data);
};
-template <class ELFT> InputSectionBase<ELFT> InputSectionBase<ELFT>::Discarded;
-
// SectionPiece represents a piece of splittable section contents.
// We allocate a lot of these and binary search on them. This means that they
// have to be as compact as possible, which is why we don't store the size (can
@@ -238,10 +234,13 @@ template <class ELFT> class InputSection
typedef typename ELFT::uint uintX_t;
public:
+ InputSection();
InputSection(uintX_t Flags, uint32_t Type, uintX_t Addralign,
ArrayRef<uint8_t> Data, StringRef Name);
InputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header, StringRef Name);
+ static InputSection<ELFT> Discarded;
+
// Write this section to a mmap'ed file, assuming Buf is pointing to
// beginning of the output section.
void writeTo(uint8_t *Buf);
@@ -287,6 +286,8 @@ private:
llvm::TinyPtrVector<const Thunk<ELFT> *> Thunks;
};
+template <class ELFT> InputSection<ELFT> InputSection<ELFT>::Discarded;
+
// MIPS .reginfo section provides information on the registers used by the code
// in the object file. Linker should collect this information and write a single
// .reginfo section in the output file. The output section contains a union of
More information about the llvm-commits
mailing list