<div dir="ltr">Thank you for doing this. I like this change!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 22, 2017 at 6:32 PM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Feb 22 20:32:18 2017<br>
New Revision: 295924<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=295924&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=295924&view=rev</a><br>
Log:<br>
Merge InputSectionData and InputSectionBase.<br>
<br>
Now that InputSectionBase is not a template there is no reason to have<br>
the two.<br>
<br>
Modified:<br>
lld/trunk/ELF/Driver.cpp<br>
lld/trunk/ELF/InputFiles.h<br>
lld/trunk/ELF/InputSection.cpp<br>
lld/trunk/ELF/InputSection.h<br>
lld/trunk/ELF/LinkerScript.cpp<br>
lld/trunk/ELF/LinkerScript.h<br>
lld/trunk/ELF/MapFile.cpp<br>
lld/trunk/ELF/OutputSections.<wbr>cpp<br>
lld/trunk/ELF/OutputSections.h<br>
lld/trunk/ELF/<wbr>SyntheticSections.h<br>
lld/trunk/ELF/Target.cpp<br>
lld/trunk/ELF/Target.h<br>
lld/trunk/ELF/Writer.cpp<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/Driver.<wbr>cpp?rev=295924&r1=295923&r2=<wbr>295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Wed Feb 22 20:32:18 2017<br>
@@ -848,7 +848,7 @@ template <class ELFT> void LinkerDriver:<br>
if (S && S != &InputSection<ELFT>::<wbr>Discarded)<br>
Symtab.Sections.push_back(S);<br>
for (BinaryFile *F : Symtab.getBinaryFiles())<br>
- for (InputSectionData *S : F->getSections())<br>
+ for (InputSectionBase *S : F->getSections())<br>
Symtab.Sections.push_back(<wbr>cast<InputSection<ELFT>>(S));<br>
<br>
// Do size optimizations: garbage collection and identical code folding.<br>
<br>
Modified: lld/trunk/ELF/InputFiles.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputFiles.h?rev=295924&r1=<wbr>295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputFiles.h (original)<br>
+++ lld/trunk/ELF/InputFiles.h Wed Feb 22 20:32:18 2017<br>
@@ -322,10 +322,10 @@ public:<br>
explicit BinaryFile(MemoryBufferRef M) : InputFile(BinaryKind, M) {}<br>
static bool classof(const InputFile *F) { return F->kind() == BinaryKind; }<br>
template <class ELFT> void parse();<br>
- ArrayRef<InputSectionData *> getSections() const { return Sections; }<br>
+ ArrayRef<InputSectionBase *> getSections() const { return Sections; }<br>
<br>
private:<br>
- std::vector<InputSectionData *> Sections;<br>
+ std::vector<InputSectionBase *> Sections;<br>
};<br>
<br>
InputFile *createObjectFile(<wbr>MemoryBufferRef MB, StringRef ArchiveName = "",<br>
<br>
Modified: lld/trunk/ELF/InputSection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputSection.cpp?rev=295924&<wbr>r1=295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.cpp (original)<br>
+++ lld/trunk/ELF/InputSection.cpp Wed Feb 22 20:32:18 2017<br>
@@ -53,10 +53,10 @@ InputSectionBase::<wbr>InputSectionBase(Input<br>
uint32_t Link, uint32_t Info,<br>
uint64_t Addralign, ArrayRef<uint8_t> Data,<br>
StringRef Name, Kind SectionKind)<br>
- : InputSectionData(SectionKind, Name, Data,<br>
- !Config->GcSections || !(Flags & SHF_ALLOC)),<br>
- File(File), Flags(Flags), Entsize(Entsize), Type(Type), Link(Link),<br>
- Info(Info), Repl(this) {<br>
+ : File(File), Data(Data), Name(Name), SectionKind(SectionKind),<br>
+ Live(!Config->GcSections || !(Flags & SHF_ALLOC)), Assigned(false),<br>
+ Flags(Flags), Entsize(Entsize), Type(Type), Link(Link), Info(Info),<br>
+ Repl(this) {<br>
NumRelocations = 0;<br>
AreRelocsRela = false;<br>
<br>
@@ -198,7 +198,7 @@ InputSection<ELFT>::<wbr>InputSection(elf::Ob<br>
: InputSectionBase(F, Header, Name, InputSectionBase::Regular) {}<br>
<br>
template <class ELFT><br>
-bool InputSection<ELFT>::classof(<wbr>const InputSectionData *S) {<br>
+bool InputSection<ELFT>::classof(<wbr>const InputSectionBase *S) {<br>
return S->kind() == InputSectionBase::Regular ||<br>
S->kind() == InputSectionBase::Synthetic;<br>
}<br>
@@ -583,7 +583,7 @@ EhInputSection<ELFT>::<wbr>EhInputSection(elf<br>
}<br>
<br>
template <class ELFT><br>
-bool EhInputSection<ELFT>::classof(<wbr>const InputSectionData *S) {<br>
+bool EhInputSection<ELFT>::classof(<wbr>const InputSectionBase *S) {<br>
return S->kind() == InputSectionBase::EHFrame;<br>
}<br>
<br>
@@ -711,7 +711,7 @@ template <class ELFT> void MergeInputSec<br>
}<br>
<br>
template <class ELFT><br>
-bool MergeInputSection<ELFT>::<wbr>classof(const InputSectionData *S) {<br>
+bool MergeInputSection<ELFT>::<wbr>classof(const InputSectionBase *S) {<br>
return S->kind() == InputSectionBase::Merge;<br>
}<br>
<br>
<br>
Modified: lld/trunk/ELF/InputSection.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputSection.h?rev=295924&r1=<wbr>295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.h (original)<br>
+++ lld/trunk/ELF/InputSection.h Wed Feb 22 20:32:18 2017<br>
@@ -33,49 +33,27 @@ template <class ELFT> class ObjectFile;<br>
template <class ELFT> class OutputSection;<br>
class OutputSectionBase;<br>
<br>
-// We need non-template input section class to store symbol layout<br>
-// in linker script parser structures, where we do not have ELFT<br>
-// template parameter. For each scripted output section symbol we<br>
-// store pointer to preceding InputSectionData object or nullptr,<br>
-// if symbol should be placed at the very beginning of the output<br>
-// section<br>
-class InputSectionData {<br>
+// This corresponds to a section of an input file.<br>
+class InputSectionBase {<br>
public:<br>
enum Kind { Regular, EHFrame, Merge, Synthetic, };<br>
<br>
- // The garbage collector sets sections' Live bits.<br>
- // If GC is disabled, all sections are considered live by default.<br>
- InputSectionData(Kind SectionKind, StringRef Name, ArrayRef<uint8_t> Data,<br>
- bool Live)<br>
- : SectionKind(SectionKind), Live(Live), Assigned(false), Name(Name),<br>
- Data(Data) {}<br>
-<br>
-private:<br>
- unsigned SectionKind : 3;<br>
-<br>
-public:<br>
Kind kind() const { return (Kind)SectionKind; }<br>
+ // The file this section is from.<br>
+ InputFile *File;<br>
<br>
- unsigned Live : 1; // for garbage collection<br>
- unsigned Assigned : 1; // for linker script<br>
- uint32_t Alignment;<br>
- StringRef Name;<br>
ArrayRef<uint8_t> Data;<br>
<br>
- template <typename T> llvm::ArrayRef<T> getDataAs() const {<br>
- size_t S = Data.size();<br>
- assert(S % sizeof(T) == 0);<br>
- return llvm::makeArrayRef<T>((const T *)Data.data(), S / sizeof(T));<br>
- }<br>
+ StringRef Name;<br>
<br>
- std::vector<Relocation> Relocations;<br>
-};<br>
+ unsigned SectionKind : 3;<br>
<br>
-// This corresponds to a section of an input file.<br>
-class InputSectionBase : public InputSectionData {<br>
-public:<br>
- // The file this section is from.<br>
- InputFile *File;<br>
+ // The garbage collector sets sections' Live bits.<br>
+ // If GC is disabled, all sections are considered live by default.<br>
+ unsigned Live : 1; // for garbage collection<br>
+ unsigned Assigned : 1; // for linker script<br>
+<br>
+ uint32_t Alignment;<br>
<br>
// These corresponds to the fields in Elf_Shdr.<br>
uint64_t Flags;<br>
@@ -86,7 +64,7 @@ public:<br>
uint32_t Info;<br>
<br>
InputSectionBase()<br>
- : InputSectionData(Regular, "", ArrayRef<uint8_t>(), false), Repl(this) {<br>
+ : SectionKind(Regular), Live(false), Assigned(false), Repl(this) {<br>
NumRelocations = 0;<br>
AreRelocsRela = false;<br>
}<br>
@@ -153,6 +131,14 @@ public:<br>
template <class ELFT> std::string getLocation(uint64_t Offset);<br>
<br>
template <class ELFT> void relocate(uint8_t *Buf, uint8_t *BufEnd);<br>
+<br>
+ std::vector<Relocation> Relocations;<br>
+<br>
+ template <typename T> llvm::ArrayRef<T> getDataAs() const {<br>
+ size_t S = Data.size();<br>
+ assert(S % sizeof(T) == 0);<br>
+ return llvm::makeArrayRef<T>((const T *)Data.data(), S / sizeof(T));<br>
+ }<br>
};<br>
<br>
// SectionPiece represents a piece of splittable section contents.<br>
@@ -179,7 +165,7 @@ template <class ELFT> class MergeInputSe<br>
public:<br>
MergeInputSection(ObjectFile<<wbr>ELFT> *F, const Elf_Shdr *Header,<br>
StringRef Name);<br>
- static bool classof(const InputSectionData *S);<br>
+ static bool classof(const InputSectionBase *S);<br>
void splitIntoPieces();<br>
<br>
// Mark the piece at a given offset live. Used by GC.<br>
@@ -233,11 +219,11 @@ private:<br>
};<br>
<br>
struct EhSectionPiece : public SectionPiece {<br>
- EhSectionPiece(size_t Off, InputSectionData *ID, uint32_t Size,<br>
+ EhSectionPiece(size_t Off, InputSectionBase *ID, uint32_t Size,<br>
unsigned FirstRelocation)<br>
: SectionPiece(Off, false), ID(ID), Size(Size),<br>
FirstRelocation(<wbr>FirstRelocation) {}<br>
- InputSectionData *ID;<br>
+ InputSectionBase *ID;<br>
uint32_t Size;<br>
uint32_t size() const { return Size; }<br>
<br>
@@ -251,7 +237,7 @@ public:<br>
typedef typename ELFT::Shdr Elf_Shdr;<br>
typedef typename ELFT::uint uintX_t;<br>
EhInputSection(ObjectFile<<wbr>ELFT> *F, const Elf_Shdr *Header, StringRef Name);<br>
- static bool classof(const InputSectionData *S);<br>
+ static bool classof(const InputSectionBase *S);<br>
void split();<br>
template <class RelTy> void split(ArrayRef<RelTy> Rels);<br>
<br>
@@ -267,13 +253,11 @@ template <class ELFT> class InputSection<br>
typedef typename ELFT::Rel Elf_Rel;<br>
typedef typename ELFT::Sym Elf_Sym;<br>
typedef typename ELFT::uint uintX_t;<br>
- typedef InputSectionData::Kind Kind;<br>
<br>
public:<br>
InputSection();<br>
InputSection(uintX_t Flags, uint32_t Type, uintX_t Addralign,<br>
- ArrayRef<uint8_t> Data, StringRef Name,<br>
- Kind K = InputSectionData::Regular);<br>
+ ArrayRef<uint8_t> Data, StringRef Name, Kind K = Regular);<br>
InputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header, StringRef Name);<br>
<br>
static InputSection<ELFT> Discarded;<br>
@@ -286,7 +270,7 @@ public:<br>
// to. The writer sets a value.<br>
uint64_t OutSecOff = 0;<br>
<br>
- static bool classof(const InputSectionData *S);<br>
+ static bool classof(const InputSectionBase *S);<br>
<br>
InputSectionBase *getRelocatedSection();<br>
<br>
<br>
Modified: lld/trunk/ELF/LinkerScript.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>LinkerScript.cpp?rev=295924&<wbr>r1=295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.cpp (original)<br>
+++ lld/trunk/ELF/LinkerScript.cpp Wed Feb 22 20:32:18 2017<br>
@@ -196,22 +196,22 @@ template <class ELFT> bool LinkerScript<<br>
return false;<br>
}<br>
<br>
-static bool comparePriority(<wbr>InputSectionData *A, InputSectionData *B) {<br>
+static bool comparePriority(<wbr>InputSectionBase *A, InputSectionBase *B) {<br>
return getPriority(A->Name) < getPriority(B->Name);<br>
}<br>
<br>
-static bool compareName(InputSectionData *A, InputSectionData *B) {<br>
+static bool compareName(InputSectionBase *A, InputSectionBase *B) {<br>
return A->Name < B->Name;<br>
}<br>
<br>
-static bool compareAlignment(<wbr>InputSectionData *A, InputSectionData *B) {<br>
+static bool compareAlignment(<wbr>InputSectionBase *A, InputSectionBase *B) {<br>
// ">" is not a mistake. Larger alignments are placed before smaller<br>
// alignments in order to reduce the amount of padding necessary.<br>
// This is compatible with GNU.<br>
return A->Alignment > B->Alignment;<br>
}<br>
<br>
-static std::function<bool(<wbr>InputSectionData *, InputSectionData *)><br>
+static std::function<bool(<wbr>InputSectionBase *, InputSectionBase *)><br>
getComparator(<wbr>SortSectionPolicy K) {<br>
switch (K) {<br>
case SortSectionPolicy::Alignment:<br>
@@ -230,7 +230,7 @@ static bool matchConstraints(ArrayRef<In<br>
ConstraintKind Kind) {<br>
if (Kind == ConstraintKind::NoConstraint)<br>
return true;<br>
- bool IsRW = llvm::any_of(Sections, [=](InputSectionData *Sec2) {<br>
+ bool IsRW = llvm::any_of(Sections, [=](InputSectionBase *Sec2) {<br>
auto *Sec = static_cast<InputSectionBase *>(Sec2);<br>
return Sec->Flags & SHF_WRITE;<br>
});<br>
@@ -238,7 +238,7 @@ static bool matchConstraints(ArrayRef<In<br>
(!IsRW && Kind == ConstraintKind::ReadOnly);<br>
}<br>
<br>
-static void sortSections(InputSectionData **Begin, InputSectionData **End,<br>
+static void sortSections(InputSectionBase **Begin, InputSectionBase **End,<br>
SortSectionPolicy K) {<br>
if (K != SortSectionPolicy::Default && K != SortSectionPolicy::None)<br>
std::stable_sort(Begin, End, getComparator(K));<br>
@@ -281,8 +281,8 @@ void LinkerScript<ELFT>::<wbr>computeInputSec<br>
// --sort-section is handled as an inner SORT command.<br>
// 3. If one SORT command is given, and if it is SORT_NONE, don't sort.<br>
// 4. If no SORT command is given, sort according to --sort-section.<br>
- InputSectionData **Begin = I->Sections.data() + SizeBefore;<br>
- InputSectionData **End = I->Sections.data() + I->Sections.size();<br>
+ InputSectionBase **Begin = I->Sections.data() + SizeBefore;<br>
+ InputSectionBase **End = I->Sections.data() + I->Sections.size();<br>
if (Pat.SortOuter != SortSectionPolicy::None) {<br>
if (Pat.SortInner == SortSectionPolicy::Default)<br>
sortSections(Begin, End, Config->SortSection);<br>
@@ -313,7 +313,7 @@ LinkerScript<ELFT>::<wbr>createInputSectionLi<br>
if (!Cmd)<br>
continue;<br>
computeInputSections(Cmd);<br>
- for (InputSectionData *S : Cmd->Sections)<br>
+ for (InputSectionBase *S : Cmd->Sections)<br>
Ret.push_back(static_cast<<wbr>InputSectionBase *>(S));<br>
}<br>
<br>
@@ -492,7 +492,7 @@ template <class ELFT> void LinkerScript<<br>
// calculates and assigns the offsets for each section and also<br>
// updates the output section size.<br>
auto &ICmd = cast<InputSectionDescription>(<wbr>Base);<br>
- for (InputSectionData *ID : ICmd.Sections) {<br>
+ for (InputSectionBase *ID : ICmd.Sections) {<br>
// We tentatively added all synthetic sections at the beginning and removed<br>
// empty ones afterwards (because there is no way to know whether they were<br>
// going be empty or not other than actually running linker scripts.)<br>
<br>
Modified: lld/trunk/ELF/LinkerScript.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>LinkerScript.h?rev=295924&r1=<wbr>295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.h (original)<br>
+++ lld/trunk/ELF/LinkerScript.h Wed Feb 22 20:32:18 2017<br>
@@ -35,7 +35,7 @@ class InputSectionBase;<br>
template <class ELFT> class InputSection;<br>
class OutputSectionBase;<br>
template <class ELFT> class OutputSectionFactory;<br>
-class InputSectionData;<br>
+class InputSectionBase;<br>
<br>
// This represents an expression in the linker script.<br>
// ScriptParser::readExpr reads an expression and returns an Expr.<br>
@@ -159,7 +159,7 @@ struct InputSectionDescription : BaseCom<br>
// will be associated with this InputSectionDescription.<br>
std::vector<SectionPattern> SectionPatterns;<br>
<br>
- std::vector<InputSectionData *> Sections;<br>
+ std::vector<InputSectionBase *> Sections;<br>
};<br>
<br>
// Represents an ASSERT().<br>
@@ -307,7 +307,7 @@ private:<br>
void output(InputSection<ELFT> *Sec);<br>
void process(BaseCommand &Base);<br>
llvm::DenseSet<<wbr>OutputSectionBase *> AlreadyOutputOS;<br>
- llvm::DenseSet<<wbr>InputSectionData *> AlreadyOutputIS;<br>
+ llvm::DenseSet<<wbr>InputSectionBase *> AlreadyOutputIS;<br>
};<br>
<br>
// Variable template is a C++14 feature, so we can't template<br>
<br>
Modified: lld/trunk/ELF/MapFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/MapFile.<wbr>cpp?rev=295924&r1=295923&r2=<wbr>295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/MapFile.cpp (original)<br>
+++ lld/trunk/ELF/MapFile.cpp Wed Feb 22 20:32:18 2017<br>
@@ -107,7 +107,7 @@ static void writeMapFile2(raw_fd_ostream<br>
OS << '\n';<br>
<br>
StringRef PrevName = "";<br>
- Sec->forEachInputSection([&](<wbr>InputSectionData *S) {<br>
+ Sec->forEachInputSection([&](<wbr>InputSectionBase *S) {<br>
if (const auto *IS = dyn_cast<InputSection<ELFT>>(<wbr>S))<br>
writeInputSection(OS, IS, PrevName);<br>
});<br>
<br>
Modified: lld/trunk/ELF/OutputSections.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>OutputSections.cpp?rev=295924&<wbr>r1=295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/OutputSections.<wbr>cpp (original)<br>
+++ lld/trunk/ELF/OutputSections.<wbr>cpp Wed Feb 22 20:32:18 2017<br>
@@ -89,8 +89,8 @@ template <typename ELFT><br>
static bool compareByFilePosition(<wbr>InputSection<ELFT> *A,<br>
InputSection<ELFT> *B) {<br>
// Synthetic doesn't have link order dependecy, stable_sort will keep it last<br>
- if (A->kind() == InputSectionData::Synthetic ||<br>
- B->kind() == InputSectionData::Synthetic)<br>
+ if (A->kind() == InputSectionBase::Synthetic ||<br>
+ B->kind() == InputSectionBase::Synthetic)<br>
return false;<br>
auto *LA = cast<InputSection<ELFT>>(A-><wbr>template getLinkOrderDep<ELFT>());<br>
auto *LB = cast<InputSection<ELFT>>(B-><wbr>template getLinkOrderDep<ELFT>());<br>
@@ -131,7 +131,7 @@ template <class ELFT> void OutputSection<br>
}<br>
<br>
template <class ELFT><br>
-void OutputSection<ELFT>::<wbr>addSection(InputSectionData *C) {<br>
+void OutputSection<ELFT>::<wbr>addSection(InputSectionBase *C) {<br>
assert(C->Live);<br>
auto *S = cast<InputSection<ELFT>>(C);<br>
Sections.push_back(S);<br>
@@ -145,7 +145,7 @@ void OutputSection<ELFT>::<wbr>addSection(Inp<br>
<br>
template <class ELFT><br>
void OutputSection<ELFT>::<wbr>forEachInputSection(<br>
- std::function<void(<wbr>InputSectionData *)> F) {<br>
+ std::function<void(<wbr>InputSectionBase *)> F) {<br>
for (InputSection<ELFT> *S : Sections)<br>
F(S);<br>
}<br>
@@ -163,7 +163,7 @@ template <class ELFT> void OutputSection<br>
}<br>
<br>
template <class ELFT><br>
-void OutputSection<ELFT>::sort(std:<wbr>:function<int(InputSectionData *S)> Order) {<br>
+void OutputSection<ELFT>::sort(std:<wbr>:function<int(InputSectionBase *S)> Order) {<br>
typedef std::pair<unsigned, InputSection<ELFT> *> Pair;<br>
auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; };<br>
<br>
@@ -184,7 +184,7 @@ void OutputSection<ELFT>::sort(std:<wbr>:func<br>
// For more detail, read the section of the GCC's manual about init_priority.<br>
template <class ELFT> void OutputSection<ELFT>::<wbr>sortInitFini() {<br>
// Sort sections by priority.<br>
- sort([](InputSectionData *S) { return getPriority(S->Name); });<br>
+ sort([](InputSectionBase *S) { return getPriority(S->Name); });<br>
}<br>
<br>
// Returns true if S matches /Filename.?\.o$/.<br>
@@ -277,7 +277,7 @@ EhOutputSection<ELFT>::<wbr>EhOutputSection()<br>
<br>
template <class ELFT><br>
void EhOutputSection<ELFT>::<wbr>forEachInputSection(<br>
- std::function<void(<wbr>InputSectionData *)> F) {<br>
+ std::function<void(<wbr>InputSectionBase *)> F) {<br>
for (EhInputSection<ELFT> *S : Sections)<br>
F(S);<br>
}<br>
@@ -366,7 +366,7 @@ void EhOutputSection<ELFT>::<wbr>addSectionAu<br>
}<br>
<br>
template <class ELFT><br>
-void EhOutputSection<ELFT>::<wbr>addSection(InputSectionData *C) {<br>
+void EhOutputSection<ELFT>::<wbr>addSection(InputSectionBase *C) {<br>
auto *Sec = cast<EhInputSection<ELFT>>(C);<br>
Sec->OutSec = this;<br>
this->updateAlignment(Sec-><wbr>Alignment);<br>
<br>
Modified: lld/trunk/ELF/OutputSections.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>OutputSections.h?rev=295924&<wbr>r1=295923&r2=295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/OutputSections.h (original)<br>
+++ lld/trunk/ELF/OutputSections.h Wed Feb 22 20:32:18 2017<br>
@@ -53,7 +53,7 @@ public:<br>
template <typename ELFT> void writeHeaderTo(typename ELFT::Shdr *SHdr);<br>
StringRef getName() const { return Name; }<br>
<br>
- virtual void addSection(InputSectionData *C) {}<br>
+ virtual void addSection(InputSectionBase *C) {}<br>
virtual Kind getKind() const { return Base; }<br>
static bool classof(const OutputSectionBase *B) {<br>
return B->getKind() == Base;<br>
@@ -81,7 +81,7 @@ public:<br>
OutputSectionBase *FirstInPtLoad = nullptr;<br>
<br>
virtual void finalize() {}<br>
- virtual void forEachInputSection(std::<wbr>function<void(InputSectionData *)> F) {}<br>
+ virtual void forEachInputSection(std::<wbr>function<void(InputSectionBase *)> F) {}<br>
virtual void assignOffsets() {}<br>
virtual void writeTo(uint8_t *Buf) {}<br>
virtual ~OutputSectionBase() = default;<br>
@@ -111,13 +111,13 @@ public:<br>
typedef typename ELFT::Rela Elf_Rela;<br>
typedef typename ELFT::uint uintX_t;<br>
OutputSection(StringRef Name, uint32_t Type, uintX_t Flags);<br>
- void addSection(InputSectionData *C) override;<br>
- void sort(std::function<int(<wbr>InputSectionData *S)> Order);<br>
+ void addSection(InputSectionBase *C) override;<br>
+ void sort(std::function<int(<wbr>InputSectionBase *S)> Order);<br>
void sortInitFini();<br>
void sortCtorsDtors();<br>
void writeTo(uint8_t *Buf) override;<br>
void finalize() override;<br>
- void forEachInputSection(std::<wbr>function<void(InputSectionData *)> F) override;<br>
+ void forEachInputSection(std::<wbr>function<void(InputSectionBase *)> F) override;<br>
void assignOffsets() override;<br>
Kind getKind() const override { return Regular; }<br>
static bool classof(const OutputSectionBase *B) {<br>
@@ -146,9 +146,9 @@ public:<br>
void writeTo(uint8_t *Buf) override;<br>
void finalize() override;<br>
bool empty() const { return Sections.empty(); }<br>
- void forEachInputSection(std::<wbr>function<void(InputSectionData *)> F) override;<br>
+ void forEachInputSection(std::<wbr>function<void(InputSectionBase *)> F) override;<br>
<br>
- void addSection(InputSectionData *S) override;<br>
+ void addSection(InputSectionBase *S) override;<br>
Kind getKind() const override { return EHFrame; }<br>
static bool classof(const OutputSectionBase *B) {<br>
return B->getKind() == EHFrame;<br>
<br>
Modified: lld/trunk/ELF/<wbr>SyntheticSections.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>SyntheticSections.h?rev=<wbr>295924&r1=295923&r2=295924&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/<wbr>SyntheticSections.h (original)<br>
+++ lld/trunk/ELF/<wbr>SyntheticSections.h Wed Feb 22 20:32:18 2017<br>
@@ -40,7 +40,7 @@ public:<br>
SyntheticSection(uintX_t Flags, uint32_t Type, uintX_t Addralign,<br>
StringRef Name)<br>
: InputSection<ELFT>(Flags, Type, Addralign, {}, Name,<br>
- InputSectionData::Synthetic) {<br>
+ InputSectionBase::Synthetic) {<br>
this->Live = true;<br>
}<br>
<br>
@@ -54,8 +54,8 @@ public:<br>
return this->OutSec ? this->OutSec->Addr + this->OutSecOff : 0;<br>
}<br>
<br>
- static bool classof(const InputSectionData *D) {<br>
- return D->kind() == InputSectionData::Synthetic;<br>
+ static bool classof(const InputSectionBase *D) {<br>
+ return D->kind() == InputSectionBase::Synthetic;<br>
}<br>
};<br>
<br>
<br>
Modified: lld/trunk/ELF/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/Target.<wbr>cpp?rev=295924&r1=295923&r2=<wbr>295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Target.cpp (original)<br>
+++ lld/trunk/ELF/Target.cpp Wed Feb 22 20:32:18 2017<br>
@@ -60,7 +60,7 @@ static void or32le(uint8_t *P, int32_t V<br>
static void or32be(uint8_t *P, int32_t V) { write32be(P, read32be(P) | V); }<br>
<br>
template <class ELFT> static std::string getErrorLoc(uint8_t *Loc) {<br>
- for (InputSectionData *D : Symtab<ELFT>::X->Sections) {<br>
+ for (InputSectionBase *D : Symtab<ELFT>::X->Sections) {<br>
auto *IS = dyn_cast_or_null<InputSection<<wbr>ELFT>>(D);<br>
if (!IS || !IS->OutSec)<br>
continue;<br>
@@ -226,8 +226,8 @@ public:<br>
void writePltHeader(uint8_t *Buf) const override;<br>
void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr,<br>
int32_t Index, unsigned RelOff) const override;<br>
- void addPltSymbols(InputSectionData *IS, uint64_t Off) const override;<br>
- void addPltHeaderSymbols(<wbr>InputSectionData *ISD) const override;<br>
+ void addPltSymbols(InputSectionBase *IS, uint64_t Off) const override;<br>
+ void addPltHeaderSymbols(<wbr>InputSectionBase *ISD) const override;<br>
bool needsThunk(RelExpr Expr, uint32_t RelocType, const InputFile *File,<br>
const SymbolBody &S) const override;<br>
void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;<br>
@@ -1758,7 +1758,7 @@ void ARMTargetInfo::writePltHeader(<wbr>uint8<br>
write32le(Buf + 16, GotPlt - L1 - 8);<br>
}<br>
<br>
-void ARMTargetInfo::<wbr>addPltHeaderSymbols(<wbr>InputSectionData *ISD) const {<br>
+void ARMTargetInfo::<wbr>addPltHeaderSymbols(<wbr>InputSectionBase *ISD) const {<br>
auto *IS = cast<InputSection<ELF32LE>>(<wbr>ISD);<br>
addSyntheticLocal<ELF32LE>("$<wbr>a", STT_NOTYPE, 0, 0, IS);<br>
addSyntheticLocal<ELF32LE>("$<wbr>d", STT_NOTYPE, 16, 0, IS);<br>
@@ -1781,7 +1781,7 @@ void ARMTargetInfo::writePlt(uint8_<wbr>t *Bu<br>
write32le(Buf + 12, GotEntryAddr - L1 - 8);<br>
}<br>
<br>
-void ARMTargetInfo::addPltSymbols(<wbr>InputSectionData *ISD, uint64_t Off) const {<br>
+void ARMTargetInfo::addPltSymbols(<wbr>InputSectionBase *ISD, uint64_t Off) const {<br>
auto *IS = cast<InputSection<ELF32LE>>(<wbr>ISD);<br>
addSyntheticLocal<ELF32LE>("$<wbr>a", STT_NOTYPE, Off, 0, IS);<br>
addSyntheticLocal<ELF32LE>("$<wbr>d", STT_NOTYPE, Off + 12, 0, IS);<br>
<br>
Modified: lld/trunk/ELF/Target.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/Target.<wbr>h?rev=295924&r1=295923&r2=<wbr>295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Target.h (original)<br>
+++ lld/trunk/ELF/Target.h Wed Feb 22 20:32:18 2017<br>
@@ -41,8 +41,8 @@ public:<br>
virtual void writePlt(uint8_t *Buf, uint64_t GotEntryAddr,<br>
uint64_t PltEntryAddr, int32_t Index,<br>
unsigned RelOff) const {}<br>
- virtual void addPltHeaderSymbols(<wbr>InputSectionData *IS) const {}<br>
- virtual void addPltSymbols(InputSectionData *IS, uint64_t Off) const {}<br>
+ virtual void addPltHeaderSymbols(<wbr>InputSectionBase *IS) const {}<br>
+ virtual void addPltSymbols(InputSectionBase *IS, uint64_t Off) const {}<br>
// Returns true if a relocation only uses the low bits of a value such that<br>
// all those bits are in in the same page. For example, if the relocation<br>
// only uses the low 12 bits in a system with 4k pages. If this is true, the<br>
<br>
Modified: lld/trunk/ELF/Writer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=295924&r1=295923&r2=295924&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/Writer.<wbr>cpp?rev=295924&r1=295923&r2=<wbr>295924&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Writer.cpp (original)<br>
+++ lld/trunk/ELF/Writer.cpp Wed Feb 22 20:32:18 2017<br>
@@ -526,8 +526,8 @@ template <class ELFT> void Writer<ELFT>:<br>
// Create one STT_SECTION symbol for each output section we might<br>
// have a relocation with.<br>
for (OutputSectionBase *Sec : OutputSections) {<br>
- InputSectionData *First = nullptr;<br>
- Sec->forEachInputSection([&](<wbr>InputSectionData *D) {<br>
+ InputSectionBase *First = nullptr;<br>
+ Sec->forEachInputSection([&](<wbr>InputSectionBase *D) {<br>
if (!First)<br>
First = D;<br>
});<br>
@@ -885,7 +885,7 @@ static void sortBySymbolsOrder(ArrayRef<<br>
SymbolOrder.insert({S, Priority++});<br>
<br>
// Build a map from sections to their priorities.<br>
- DenseMap<InputSectionData *, int> SectionOrder;<br>
+ DenseMap<InputSectionBase *, int> SectionOrder;<br>
for (elf::ObjectFile<ELFT> *File : Symtab<ELFT>::X-><wbr>getObjectFiles()) {<br>
for (SymbolBody *Body : File->getSymbols()) {<br>
auto *D = dyn_cast<DefinedRegular<ELFT>><wbr>(Body);<br>
@@ -899,7 +899,7 @@ static void sortBySymbolsOrder(ArrayRef<<br>
// Sort sections by priority.<br>
for (OutputSectionBase *Base : OutputSections)<br>
if (auto *Sec = dyn_cast<OutputSection<ELFT>>(<wbr>Base))<br>
- Sec->sort([&](InputSectionData *S) { return SectionOrder.lookup(S); });<br>
+ Sec->sort([&](InputSectionBase *S) { return SectionOrder.lookup(S); });<br>
}<br>
<br>
template <class ELFT><br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>