diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-01 21:48:00 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-01 21:48:00 +0000 |
| commit | ec05a574fe59886e66516a2a9fba58e2f6357321 (patch) | |
| tree | c42299ceae7220959df289a695c6b0dfd3b39d5e /lld/ELF/InputFiles.cpp | |
| parent | e036907c59342edecccd3bac8d3ea6c8a0ef24f4 (diff) | |
| download | bcm5719-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/InputFiles.cpp')
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 8 |
1 files changed, 5 insertions, 3 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: |

