diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 855fe776c836..ef01735f13d2 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -147,9 +147,6 @@ public: } ErrorOr getSectionStringTable(Elf_Shdr_Range Sections) const; - ErrorOr - getExtendedSymbolTableIndex(const Elf_Sym *Sym, const Elf_Shdr *SymTab, - ArrayRef ShndxTable) const; const Elf_Ehdr *getHeader() const { return Header; } ErrorOr getSectionIndex(const Elf_Sym *Sym, const Elf_Shdr *SymTab, ArrayRef ShndxTable) const; @@ -203,24 +200,18 @@ getExtendedSymbolTableIndex(const typename ELFT::Sym *Sym, return ShndxTable[Index]; } -template -ErrorOr ELFFile::getExtendedSymbolTableIndex( - const Elf_Sym *Sym, const Elf_Shdr *SymTab, - ArrayRef ShndxTable) const { - auto SymsOrErr = symbols(SymTab); - if (std::error_code EC = SymsOrErr.getError()) - return EC; - return object::getExtendedSymbolTableIndex(Sym, SymsOrErr->begin(), - ShndxTable); -} - template ErrorOr ELFFile::getSectionIndex(const Elf_Sym *Sym, const Elf_Shdr *SymTab, ArrayRef ShndxTable) const { + auto SymsOrErr = symbols(SymTab); + if (std::error_code EC = SymsOrErr.getError()) + return EC; + uint32_t Index = Sym->st_shndx; if (Index == ELF::SHN_XINDEX) { - auto ErrorOrIndex = getExtendedSymbolTableIndex(Sym, SymTab, ShndxTable); + auto ErrorOrIndex = object::getExtendedSymbolTableIndex( + Sym, SymsOrErr->begin(), ShndxTable); if (std::error_code EC = ErrorOrIndex.getError()) return EC; return *ErrorOrIndex;