[lld] r312712 - [ELF] - Rename PhdrEntry::First/Last to FirstSec/LastSec. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 7 04:01:10 PDT 2017
Author: grimar
Date: Thu Sep 7 04:01:10 2017
New Revision: 312712
URL: http://llvm.org/viewvc/llvm-project?rev=312712&view=rev
Log:
[ELF] - Rename PhdrEntry::First/Last to FirstSec/LastSec. NFC.
As was suggested in D34956 thread.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/Writer.cpp
lld/trunk/ELF/Writer.h
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=312712&r1=312711&r2=312712&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Sep 7 04:01:10 2017
@@ -485,9 +485,9 @@ static uint64_t getAArch64UndefinedRelat
// of the RW segment.
static uint64_t getARMStaticBase(const SymbolBody &Body) {
OutputSection *OS = Body.getOutputSection();
- if (!OS || !OS->PtLoad || !OS->PtLoad->First)
+ if (!OS || !OS->PtLoad || !OS->PtLoad->FirstSec)
fatal("SBREL relocation to " + Body.getName() + " without static base");
- return OS->PtLoad->First->Addr;
+ return OS->PtLoad->FirstSec->Addr;
}
static uint64_t getRelocTargetVA(uint32_t Type, int64_t A, uint64_t P,
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=312712&r1=312711&r2=312712&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Sep 7 04:01:10 2017
@@ -770,7 +770,7 @@ void LinkerScript::allocateHeaders(std::
Out::ElfHeader->PtLoad = nullptr;
Out::ProgramHeaders->PtLoad = nullptr;
- FirstPTLoad->First = findFirstSection(FirstPTLoad);
+ FirstPTLoad->FirstSec = findFirstSection(FirstPTLoad);
llvm::erase_if(Phdrs,
[](const PhdrEntry *E) { return E->p_type == PT_PHDR; });
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=312712&r1=312711&r2=312712&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Sep 7 04:01:10 2017
@@ -127,9 +127,9 @@ template <class ELFT> void Writer<ELFT>:
llvm::erase_if(Phdrs, [&](const PhdrEntry *P) {
if (P->p_type != PT_LOAD)
return false;
- if (!P->First)
+ if (!P->FirstSec)
return true;
- uint64_t Size = P->Last->Addr + P->Last->Size - P->First->Addr;
+ uint64_t Size = P->LastSec->Addr + P->LastSec->Size - P->FirstSec->Addr;
return Size == 0;
});
}
@@ -741,9 +741,9 @@ static bool compareSections(const BaseCo
}
void PhdrEntry::add(OutputSection *Sec) {
- Last = Sec;
- if (!First)
- First = Sec;
+ LastSec = Sec;
+ if (!FirstSec)
+ FirstSec = Sec;
p_align = std::max(p_align, Sec->Alignment);
if (p_type == PT_LOAD)
Sec->PtLoad = this;
@@ -956,7 +956,7 @@ template <class ELFT> void Writer<ELFT>:
// _end is the first location after the uninitialized data region.
if (Last) {
for (size_t I = 0; I < V.size(); ++I) {
- if (V[I] != Last->Last)
+ if (V[I] != Last->LastSec)
continue;
if (ElfSym::End2)
V.insert(V.begin() + I + 1, Make(ElfSym::End2));
@@ -969,7 +969,7 @@ template <class ELFT> void Writer<ELFT>:
// _etext is the first location after the last read-only loadable segment.
if (LastRO) {
for (size_t I = 0; I < V.size(); ++I) {
- if (V[I] != LastRO->Last)
+ if (V[I] != LastRO->LastSec)
continue;
if (ElfSym::Etext2)
V.insert(V.begin() + I + 1, Make(ElfSym::Etext2));
@@ -983,7 +983,7 @@ template <class ELFT> void Writer<ELFT>:
if (LastRW) {
size_t I = 0;
for (; I < V.size(); ++I)
- if (V[I] == LastRW->First)
+ if (V[I] == LastRW->FirstSec)
break;
for (; I < V.size(); ++I) {
@@ -1547,7 +1547,7 @@ template <class ELFT> std::vector<PhdrEn
for (OutputSection *Sec : OutputSections)
if (Sec->Flags & SHF_TLS)
TlsHdr->add(Sec);
- if (TlsHdr->First)
+ if (TlsHdr->FirstSec)
Ret.push_back(TlsHdr);
// Add an entry for .dynamic.
@@ -1561,7 +1561,7 @@ template <class ELFT> std::vector<PhdrEn
for (OutputSection *Sec : OutputSections)
if (needsPtLoad(Sec) && isRelroSection(Sec))
RelRo->add(Sec);
- if (RelRo->First)
+ if (RelRo->FirstSec)
Ret.push_back(RelRo);
// PT_GNU_EH_FRAME is a special section pointing on .eh_frame_hdr.
@@ -1635,18 +1635,18 @@ template <class ELFT> void Writer<ELFT>:
};
for (const PhdrEntry *P : Phdrs)
- if (P->p_type == PT_LOAD && P->First)
- PageAlign(P->First);
+ if (P->p_type == PT_LOAD && P->FirstSec)
+ PageAlign(P->FirstSec);
for (const PhdrEntry *P : Phdrs) {
if (P->p_type != PT_GNU_RELRO)
continue;
- if (P->First)
- PageAlign(P->First);
+ if (P->FirstSec)
+ PageAlign(P->FirstSec);
// Find the first section after PT_GNU_RELRO. If it is in a PT_LOAD we
// have to align it to a page.
auto End = OutputSections.end();
- auto I = std::find(OutputSections.begin(), End, P->Last);
+ auto I = std::find(OutputSections.begin(), End, P->LastSec);
if (I == End || (I + 1) == End)
continue;
OutputSection *Cmd = (*(I + 1));
@@ -1664,7 +1664,7 @@ static uint64_t getFileAlignment(uint64_
if (!Cmd->PtLoad)
return alignTo(Off, Cmd->Alignment);
- OutputSection *First = Cmd->PtLoad->First;
+ OutputSection *First = Cmd->PtLoad->FirstSec;
// The first section in a PT_LOAD has to have congruent offset and address
// module the page size.
if (Cmd == First)
@@ -1713,7 +1713,7 @@ template <class ELFT> void Writer<ELFT>:
// If this is a last section of the last executable segment and that
// segment is the last loadable segment, align the offset of the
// following section to avoid loading non-segments parts of the file.
- if (LastRX && LastRX->Last == Sec)
+ if (LastRX && LastRX->LastSec == Sec)
Off = alignTo(Off, Target->PageSize);
}
@@ -1725,8 +1725,8 @@ template <class ELFT> void Writer<ELFT>:
// file offsets and VAs to all sections.
template <class ELFT> void Writer<ELFT>::setPhdrs() {
for (PhdrEntry *P : Phdrs) {
- OutputSection *First = P->First;
- OutputSection *Last = P->Last;
+ OutputSection *First = P->FirstSec;
+ OutputSection *Last = P->LastSec;
if (First) {
P->p_filesz = Last->Offset - First->Offset;
if (Last->Type != SHT_NOBITS)
Modified: lld/trunk/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.h?rev=312712&r1=312711&r2=312712&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.h (original)
+++ lld/trunk/ELF/Writer.h Thu Sep 7 04:01:10 2017
@@ -41,8 +41,8 @@ struct PhdrEntry {
uint32_t p_type = 0;
uint32_t p_flags = 0;
- OutputSection *First = nullptr;
- OutputSection *Last = nullptr;
+ OutputSection *FirstSec = nullptr;
+ OutputSection *LastSec = nullptr;
bool HasLMA = false;
};
More information about the llvm-commits
mailing list