[lld] r250358 - ELF2: Do not use OutputSection as a member variable name.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 14 18:58:41 PDT 2015
Author: ruiu
Date: Wed Oct 14 20:58:40 2015
New Revision: 250358
URL: http://llvm.org/viewvc/llvm-project?rev=250358&view=rev
Log:
ELF2: Do not use OutputSection as a member variable name.
We have OutputSection<ELFT> type. GCC 4.9.2 warns on the duplication.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/InputSection.h
lld/trunk/ELF/OutputSections.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=250358&r1=250357&r2=250358&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Oct 14 20:58:40 2015
@@ -71,11 +71,11 @@ template <class ELFT> void InputSection<
return;
// Copy section contents from source object file to output file.
ArrayRef<uint8_t> Data = *File->getObj().getSectionContents(Header);
- memcpy(Buf + OutputSectionOff, Data.data(), Data.size());
+ memcpy(Buf + OutSecOff, Data.data(), Data.size());
ELFFile<ELFT> &EObj = File->getObj();
- uint8_t *Base = Buf + OutputSectionOff;
- uintX_t BaseAddr = OutputSection->getVA() + OutputSectionOff;
+ uint8_t *Base = Buf + OutSecOff;
+ uintX_t BaseAddr = OutSec->getVA() + OutSecOff;
// Iterate over all relocation sections that apply to this section.
for (const Elf_Shdr *RelSec : RelocSections) {
if (RelSec->sh_type == SHT_RELA)
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=250358&r1=250357&r2=250358&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Oct 14 20:58:40 2015
@@ -53,8 +53,8 @@ public:
// The offset from beginning of the output sections this section was assigned
// to. The writer sets a value.
- uint64_t OutputSectionOff = 0;
- OutputSection<ELFT> *OutputSection = nullptr;
+ uint64_t OutSecOff = 0;
+ OutputSection<ELFT> *OutSec = nullptr;
static InputSection<ELFT> Discarded;
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=250358&r1=250357&r2=250358&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Oct 14 20:58:40 2015
@@ -142,7 +142,7 @@ template <class ELFT> void RelocationSec
} else {
if (IsRela)
Addend += static_cast<const Elf_Rela &>(RI).r_addend;
- P->r_offset = RI.r_offset + C.OutputSection->getVA() + C.OutputSectionOff;
+ P->r_offset = RI.r_offset + C.OutSec->getVA() + C.OutSecOff;
if (CanBePreempted)
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(), Type,
IsMips64EL);
@@ -384,14 +384,14 @@ OutputSection<ELFT>::OutputSection(Strin
template <class ELFT>
void OutputSection<ELFT>::addSection(InputSection<ELFT> *C) {
Sections.push_back(C);
- C->OutputSection = this;
+ C->OutSec = this;
uint32_t Align = C->getAlign();
if (Align > this->Header.sh_addralign)
this->Header.sh_addralign = Align;
uintX_t Off = this->Header.sh_size;
Off = RoundUpToAlignment(Off, Align);
- C->OutputSectionOff = Off;
+ C->OutSecOff = Off;
Off += C->getSize();
this->Header.sh_size = Off;
}
@@ -408,7 +408,7 @@ typename ELFFile<ELFT>::uintX_t lld::elf
case SymbolBody::DefinedRegularKind: {
const auto &DR = cast<DefinedRegular<ELFT>>(S);
const InputSection<ELFT> *SC = &DR.Section;
- return SC->OutputSection->getVA() + SC->OutputSectionOff + DR.Sym.st_value;
+ return SC->OutSec->getVA() + SC->OutSecOff + DR.Sym.st_value;
}
case SymbolBody::DefinedCommonKind:
return Out<ELFT>::Bss->getVA() + cast<DefinedCommon<ELFT>>(S).OffsetInBSS;
@@ -451,8 +451,7 @@ lld::elf2::getLocalRelTarget(const Objec
if (Section == &InputSection<ELFT>::Discarded)
return 0;
- return Section->OutputSection->getVA() + Section->OutputSectionOff +
- Sym->st_value;
+ return Section->OutSec->getVA() + Section->OutSecOff + Sym->st_value;
}
// Returns true if a symbol can be replaced at load-time by a symbol
@@ -625,10 +624,9 @@ void SymbolTableSection<ELFT>::writeLoca
SecIndex = File->getObj().getExtendedSymbolTableIndex(
&Sym, File->getSymbolTable(), File->getSymbolTableShndx());
ArrayRef<InputSection<ELFT> *> Sections = File->getSections();
- const InputSection<ELFT> *Section = Sections[SecIndex];
- const OutputSection<ELFT> *OutSec = Section->OutputSection;
- ESym->st_shndx = OutSec->getSectionIndex();
- VA += OutSec->getVA() + Section->OutputSectionOff;
+ const InputSection<ELFT> *Sec = Sections[SecIndex];
+ ESym->st_shndx = Sec->OutSec->getSectionIndex();
+ VA += Sec->OutSec->getVA() + Sec->OutSecOff;
}
ESym->st_value = VA;
}
@@ -694,7 +692,7 @@ void SymbolTableSection<ELFT>::writeGlob
ESym->st_value = getSymVA<ELFT>(*Body);
if (Section)
- OutSec = Section->OutputSection;
+ OutSec = Section->OutSec;
if (isa<DefinedAbsolute<ELFT>>(Body))
ESym->st_shndx = SHN_ABS;
More information about the llvm-commits
mailing list