Index: ELF/InputFiles.h =================================================================== --- ELF/InputFiles.h +++ ELF/InputFiles.h @@ -161,15 +161,12 @@ StringRef getStringTable() const { return StringTable; } - uint32_t getSectionIndex(const Elf_Sym &Sym) const; - Elf_Sym_Range getGlobalELFSyms(); Elf_Sym_Range getELFSyms() const { return ELFSyms; } protected: ArrayRef ELFSyms; uint32_t FirstGlobal = 0; - ArrayRef SymtabSHNDX; StringRef StringTable; void initSymtab(ArrayRef Sections, const Elf_Shdr *Symtab); }; @@ -202,6 +199,8 @@ return *this->Symbols[SymbolIndex]; } + uint32_t getSectionIndex(const Elf_Sym &Sym) const; + template Symbol &getRelocTargetSym(const RelT &Rel) const { uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL); return getSymbol(SymIndex); @@ -247,6 +246,8 @@ bool shouldMerge(const Elf_Shdr &Sec); Symbol *createSymbol(const Elf_Sym *Sym); + ArrayRef SymtabSHNDX; + // .shstrtab contents. StringRef SectionStringTable; Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -259,11 +259,6 @@ } template -uint32_t ELFFileBase::getSectionIndex(const Elf_Sym &Sym) const { - return CHECK(getObj().getSectionIndex(&Sym, ELFSyms, SymtabSHNDX), this); -} - -template void ELFFileBase::initSymtab(ArrayRef Sections, const Elf_Shdr *Symtab) { FirstGlobal = Symtab->sh_info; @@ -281,6 +276,12 @@ this->ArchiveName = ArchiveName; } +template +uint32_t ObjFile::getSectionIndex(const Elf_Sym &Sym) const { + return CHECK(this->getObj().getSectionIndex(&Sym, this->ELFSyms, SymtabSHNDX), + this); +} + template ArrayRef ObjFile::getLocalSymbols() { if (this->Symbols.empty()) return {}; @@ -890,9 +891,6 @@ case SHT_DYNAMIC: DynamicSec = &Sec; break; - case SHT_SYMTAB_SHNDX: - this->SymtabSHNDX = CHECK(Obj.getSHNDXTable(Sec, Sections), this); - break; case SHT_GNU_versym: this->VersymSec = &Sec; break;