summaryrefslogtreecommitdiffstats
path: root/lld/ELF
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-11-01 21:48:00 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-11-01 21:48:00 +0000
commitec05a574fe59886e66516a2a9fba58e2f6357321 (patch)
treec42299ceae7220959df289a695c6b0dfd3b39d5e /lld/ELF
parente036907c59342edecccd3bac8d3ea6c8a0ef24f4 (diff)
downloadbcm5719-llvm-ec05a574fe59886e66516a2a9fba58e2f6357321.tar.gz
bcm5719-llvm-ec05a574fe59886e66516a2a9fba58e2f6357321.zip
Don't fetch the section string table multiple times. NFC.
llvm-svn: 285755
Diffstat (limited to 'lld/ELF')
-rw-r--r--lld/ELF/InputFiles.cpp8
-rw-r--r--lld/ELF/InputFiles.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 041b41fd2d9..ec8958b898d 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -292,6 +292,7 @@ void elf::ObjectFile<ELFT>::initializeSections(
Sections.resize(Size);
unsigned I = -1;
const ELFFile<ELFT> &Obj = this->ELFObj;
+ StringRef SectionStringTable = check(Obj.getSectionStringTable());
for (const Elf_Shdr &Sec : Obj.sections()) {
++I;
if (Sections[I] == &InputSection<ELFT>::Discarded)
@@ -328,7 +329,7 @@ void elf::ObjectFile<ELFT>::initializeSections(
case SHT_NULL:
break;
default:
- Sections[I] = createInputSection(Sec);
+ Sections[I] = createInputSection(Sec, SectionStringTable);
}
}
}
@@ -373,8 +374,9 @@ elf::ObjectFile<ELFT>::getRelocTarget(const Elf_Shdr &Sec) {
template <class ELFT>
InputSectionBase<ELFT> *
-elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
- StringRef Name = check(this->ELFObj.getSectionName(&Sec));
+elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec,
+ StringRef SectionStringTable) {
+ StringRef Name = check(this->ELFObj.getSectionName(&Sec, SectionStringTable));
switch (Sec.sh_type) {
case SHT_ARM_ATTRIBUTES:
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index f5da90d42d5..ac9134aa96a 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -199,7 +199,8 @@ private:
void initializeSymbols();
void initializeReverseDependencies();
InputSectionBase<ELFT> *getRelocTarget(const Elf_Shdr &Sec);
- InputSectionBase<ELFT> *createInputSection(const Elf_Shdr &Sec);
+ InputSectionBase<ELFT> *createInputSection(const Elf_Shdr &Sec,
+ StringRef SectionStringTable);
bool shouldMerge(const Elf_Shdr &Sec);
SymbolBody *createSymbolBody(const Elf_Sym *Sym);
OpenPOWER on IntegriCloud