[lld] r248183 - Rename SectionChunk to InputSection.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 10:47:00 PDT 2015
Author: rafael
Date: Mon Sep 21 12:47:00 2015
New Revision: 248183
URL: http://llvm.org/viewvc/llvm-project?rev=248183&view=rev
Log:
Rename SectionChunk to InputSection.
This is more consistent with OutputSection. This is also part of removing
the "Chunk" term from the ELF linker, since we just have input/output sections
and program headers.
Modified:
lld/trunk/ELF/Chunks.cpp
lld/trunk/ELF/Chunks.h
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
lld/trunk/ELF/Symbols.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Chunks.cpp?rev=248183&r1=248182&r2=248183&view=diff
==============================================================================
--- lld/trunk/ELF/Chunks.cpp (original)
+++ lld/trunk/ELF/Chunks.cpp Mon Sep 21 12:47:00 2015
@@ -18,10 +18,10 @@ using namespace lld;
using namespace lld::elf2;
template <class ELFT>
-SectionChunk<ELFT>::SectionChunk(ObjectFile<ELFT> *F, const Elf_Shdr *Header)
+InputSection<ELFT>::InputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header)
: File(F), Header(Header) {}
-template <class ELFT> void SectionChunk<ELFT>::writeTo(uint8_t *Buf) {
+template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) {
if (Header->sh_type == SHT_NOBITS)
return;
// Copy section contents from source object file to output file.
@@ -29,7 +29,7 @@ template <class ELFT> void SectionChunk<
memcpy(Buf + OutputSectionOff, Data.data(), Data.size());
}
-template <class ELFT> StringRef SectionChunk<ELFT>::getSectionName() const {
+template <class ELFT> StringRef InputSection<ELFT>::getSectionName() const {
ErrorOr<StringRef> Name = File->getObj()->getSectionName(Header);
error(Name);
return *Name;
@@ -37,9 +37,9 @@ template <class ELFT> StringRef SectionC
namespace lld {
namespace elf2 {
-template class SectionChunk<object::ELF32LE>;
-template class SectionChunk<object::ELF32BE>;
-template class SectionChunk<object::ELF64LE>;
-template class SectionChunk<object::ELF64BE>;
+template class InputSection<object::ELF32LE>;
+template class InputSection<object::ELF32BE>;
+template class InputSection<object::ELF64LE>;
+template class InputSection<object::ELF64BE>;
}
}
Modified: lld/trunk/ELF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Chunks.h?rev=248183&r1=248182&r2=248183&view=diff
==============================================================================
--- lld/trunk/ELF/Chunks.h (original)
+++ lld/trunk/ELF/Chunks.h Mon Sep 21 12:47:00 2015
@@ -20,14 +20,14 @@ template <class ELFT> class ObjectFile;
template <class ELFT> class OutputSection;
// A chunk corresponding a section of an input file.
-template <class ELFT> class SectionChunk {
+template <class ELFT> class InputSection {
typedef typename llvm::object::ELFFile<ELFT>::Elf_Shdr Elf_Shdr;
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela Elf_Rela;
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel Elf_Rel;
typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t;
public:
- SectionChunk(ObjectFile<ELFT> *F, const Elf_Shdr *Header);
+ InputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header);
// Returns the size of this chunk (even if this is a common or BSS.)
size_t getSize() const { return Header->sh_size; }
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=248183&r1=248182&r2=248183&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Sep 21 12:47:00 2015
@@ -119,14 +119,14 @@ template <class ELFT> void elf2::ObjectF
uint32_t RelocatedSectionIndex = Sec.sh_info;
if (RelocatedSectionIndex >= Size)
error("Invalid relocated section index");
- SectionChunk<ELFT> *RelocatedSection = Chunks[RelocatedSectionIndex];
+ InputSection<ELFT> *RelocatedSection = Chunks[RelocatedSectionIndex];
if (!RelocatedSection)
error("Unsupported relocation reference");
RelocatedSection->RelocSections.push_back(&Sec);
break;
}
default:
- Chunks[I] = new (Alloc) SectionChunk<ELFT>(this, &Sec);
+ Chunks[I] = new (Alloc) InputSection<ELFT>(this, &Sec);
break;
}
++I;
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=248183&r1=248182&r2=248183&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Mon Sep 21 12:47:00 2015
@@ -132,7 +132,7 @@ public:
: ObjectFileBase(getStaticELFKind<ELFT>(), M) {}
void parse() override;
- ArrayRef<SectionChunk<ELFT> *> getChunks() const { return Chunks; }
+ ArrayRef<InputSection<ELFT> *> getChunks() const { return Chunks; }
SymbolBody *getSymbolBody(uint32_t SymbolIndex) const {
uint32_t FirstNonLocal = this->Symtab->sh_info;
@@ -153,7 +153,7 @@ private:
SymbolBody *createSymbolBody(StringRef StringTable, const Elf_Sym *Sym);
// List of all chunks defined by this file.
- std::vector<SectionChunk<ELFT> *> Chunks;
+ std::vector<InputSection<ELFT> *> Chunks;
ArrayRef<Elf_Word> SymtabSHNDX;
};
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=248183&r1=248182&r2=248183&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Mon Sep 21 12:47:00 2015
@@ -197,14 +197,14 @@ template <class ELFT> class DefinedRegul
public:
explicit DefinedRegular(StringRef N, const Elf_Sym &Sym,
- SectionChunk<ELFT> &Section)
+ InputSection<ELFT> &Section)
: Defined<ELFT>(Base::DefinedRegularKind, N, Sym), Section(Section) {}
static bool classof(const SymbolBody *S) {
return S->kind() == Base::DefinedRegularKind;
}
- const SectionChunk<ELFT> &Section;
+ const InputSection<ELFT> &Section;
};
// Undefined symbol.
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=248183&r1=248182&r2=248183&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Sep 21 12:47:00 2015
@@ -96,7 +96,7 @@ template <class ELFT> class SymbolTableS
template <class ELFT> struct DynamicReloc {
typedef typename ELFFile<ELFT>::Elf_Rel Elf_Rel;
- const SectionChunk<ELFT> &C;
+ const InputSection<ELFT> &C;
const Elf_Rel &RI;
};
@@ -225,7 +225,7 @@ public:
auto *P = reinterpret_cast<Elf_Rela *>(Buf);
bool IsMips64EL = Relocs[0].C.getFile()->getObj()->isMips64EL();
for (const DynamicReloc<ELFT> &Rel : Relocs) {
- const SectionChunk<ELFT> &C = Rel.C;
+ const InputSection<ELFT> &C = Rel.C;
const Elf_Rel &RI = Rel.RI;
OutputSection<ELFT> *Out = C.getOutputSection();
uint32_t SymIndex = RI.getSymbol(IsMips64EL);
@@ -270,7 +270,7 @@ public:
: OutputSectionBase<ELFT::Is64Bits>(Name, sh_type, sh_flags),
PltSec(PltSec), GotSec(GotSec) {}
- void addChunk(SectionChunk<ELFT> *C);
+ void addChunk(InputSection<ELFT> *C);
void writeTo(uint8_t *Buf) override;
template <bool isRela>
@@ -284,7 +284,7 @@ public:
uintX_t BaseAddr, uintX_t SymVA);
private:
- std::vector<SectionChunk<ELFT> *> Chunks;
+ std::vector<InputSection<ELFT> *> Chunks;
const PltSection<ELFT> &PltSec;
const GotSection<ELFT> &GotSec;
};
@@ -633,9 +633,9 @@ public:
private:
void createSections();
template <bool isRela>
- void scanRelocs(const SectionChunk<ELFT> &C,
+ void scanRelocs(const InputSection<ELFT> &C,
iterator_range<const Elf_Rel_Impl<ELFT, isRela> *> Rels);
- void scanRelocs(const SectionChunk<ELFT> &C);
+ void scanRelocs(const InputSection<ELFT> &C);
void assignAddresses();
void openFile(StringRef OutputPath);
void writeHeader();
@@ -711,7 +711,7 @@ template <class ELFT> void Writer<ELFT>:
}
template <class ELFT>
-void OutputSection<ELFT>::addChunk(SectionChunk<ELFT> *C) {
+void OutputSection<ELFT>::addChunk(InputSection<ELFT> *C) {
Chunks.push_back(C);
C->setOutputSection(this);
uint32_t Align = C->getAlign();
@@ -728,7 +728,7 @@ void OutputSection<ELFT>::addChunk(Secti
template <class ELFT>
static typename ELFFile<ELFT>::uintX_t
getSymVA(const DefinedRegular<ELFT> *DR) {
- const SectionChunk<ELFT> *SC = &DR->Section;
+ const InputSection<ELFT> *SC = &DR->Section;
OutputSection<ELFT> *OS = SC->getOutputSection();
return OS->getVA() + SC->getOutputSectionOff() + DR->Sym.st_value;
}
@@ -832,7 +832,7 @@ void OutputSection<ELFT>::relocate(
}
template <class ELFT> void OutputSection<ELFT>::writeTo(uint8_t *Buf) {
- for (SectionChunk<ELFT> *C : Chunks) {
+ for (InputSection<ELFT> *C : Chunks) {
C->writeTo(Buf);
const ObjectFile<ELFT> *File = C->getFile();
ELFFile<ELFT> *EObj = File->getObj();
@@ -876,7 +876,7 @@ static bool includeInSymtab(const Symbol
template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
const OutputSection<ELFT> *Out = nullptr;
- const SectionChunk<ELFT> *Section = nullptr;
+ const InputSection<ELFT> *Section = nullptr;
Buf += sizeof(Elf_Sym);
// All symbols with STB_LOCAL binding precede the weak and global symbols.
@@ -898,7 +898,7 @@ template <class ELFT> void SymbolTableSe
if (SecIndex == SHN_XINDEX)
SecIndex = File.getObj()->getExtendedSymbolTableIndex(
&Sym, File.getSymbolTable(), File.getSymbolTableShndx());
- ArrayRef<SectionChunk<ELFT> *> Chunks = File.getChunks();
+ ArrayRef<InputSection<ELFT> *> Chunks = File.getChunks();
Section = Chunks[SecIndex];
assert(Section != nullptr);
Out = Section->getOutputSection();
@@ -1035,7 +1035,7 @@ static bool compSec(OutputSectionBase<Is
template <class ELFT>
template <bool isRela>
void Writer<ELFT>::scanRelocs(
- const SectionChunk<ELFT> &C,
+ const InputSection<ELFT> &C,
iterator_range<const Elf_Rel_Impl<ELFT, isRela> *> Rels) {
typedef Elf_Rel_Impl<ELFT, isRela> RelType;
const ObjectFile<ELFT> &File = *C.getFile();
@@ -1064,7 +1064,7 @@ void Writer<ELFT>::scanRelocs(
}
template <class ELFT>
-void Writer<ELFT>::scanRelocs(const SectionChunk<ELFT> &C) {
+void Writer<ELFT>::scanRelocs(const InputSection<ELFT> &C) {
const ObjectFile<ELFT> *File = C.getFile();
ELFFile<ELFT> *EObj = File->getObj();
@@ -1126,7 +1126,7 @@ template <class ELFT> void Writer<ELFT>:
SymTabSec.addSymbol(*SymName, true);
}
}
- for (SectionChunk<ELFT> *C : File.getChunks()) {
+ for (InputSection<ELFT> *C : File.getChunks()) {
if (!C)
continue;
const Elf_Shdr *H = C->getSectionHdr();
More information about the llvm-commits
mailing list