summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-11-03 12:23:41 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-11-03 12:23:41 +0000
commit4fccc827cf8fcdbcb7edd303a421f768bf4149fc (patch)
treedda8caf16e04caf19fc409e2af8d021d2cb47d68 /llvm/include
parent84d6a171344333b7675425a241ff2a973e8fd627 (diff)
downloadbcm5719-llvm-4fccc827cf8fcdbcb7edd303a421f768bf4149fc.tar.gz
bcm5719-llvm-4fccc827cf8fcdbcb7edd303a421f768bf4149fc.zip
Split getSHNDXTable in two.
Some clients already have the section table available. llvm-svn: 285898
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Object/ELF.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h
index 71e27042af9..48120a30f4d 100644
--- a/llvm/include/llvm/Object/ELF.h
+++ b/llvm/include/llvm/Object/ELF.h
@@ -81,6 +81,8 @@ public:
ErrorOr<StringRef> getStringTableForSymtab(const Elf_Shdr &Section) const;
ErrorOr<ArrayRef<Elf_Word>> getSHNDXTable(const Elf_Shdr &Section) const;
+ ErrorOr<ArrayRef<Elf_Word>> getSHNDXTable(const Elf_Shdr &Section,
+ Elf_Shdr_Range Sections) const;
void VerifyStrTab(const Elf_Shdr *sh) const;
@@ -423,12 +425,23 @@ ELFFile<ELFT>::getStringTable(const Elf_Shdr *Section) const {
template <class ELFT>
ErrorOr<ArrayRef<typename ELFT::Word>>
ELFFile<ELFT>::getSHNDXTable(const Elf_Shdr &Section) const {
+ auto SectionsOrErr = sections();
+ if (std::error_code EC = SectionsOrErr.getError())
+ return EC;
+ return getSHNDXTable(Section, *SectionsOrErr);
+}
+
+template <class ELFT>
+ErrorOr<ArrayRef<typename ELFT::Word>>
+ELFFile<ELFT>::getSHNDXTable(const Elf_Shdr &Section,
+ Elf_Shdr_Range Sections) const {
assert(Section.sh_type == ELF::SHT_SYMTAB_SHNDX);
auto VOrErr = getSectionContentsAsArray<Elf_Word>(&Section);
if (std::error_code EC = VOrErr.getError())
return EC;
ArrayRef<Elf_Word> V = *VOrErr;
- ErrorOr<const Elf_Shdr *> SymTableOrErr = getSection(Section.sh_link);
+ ErrorOr<const Elf_Shdr *> SymTableOrErr =
+ object::getSection<ELFT>(Sections, Section.sh_link);
if (std::error_code EC = SymTableOrErr.getError())
return EC;
const Elf_Shdr &SymTable = **SymTableOrErr;
OpenPOWER on IntegriCloud