diff options
-rw-r--r-- | lld/ELF/InputFiles.cpp | 14 | ||||
-rw-r--r-- | lld/ELF/InputFiles.h | 7 |
2 files changed, 10 insertions, 11 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index d2a93af8c8d..0a181ae91f4 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -259,11 +259,6 @@ typename ELFT::SymRange ELFFileBase<ELFT>::getGlobalELFSyms() { } template <class ELFT> -uint32_t ELFFileBase<ELFT>::getSectionIndex(const Elf_Sym &Sym) const { - return CHECK(getObj().getSectionIndex(&Sym, ELFSyms, SymtabSHNDX), this); -} - -template <class ELFT> void ELFFileBase<ELFT>::initSymtab(ArrayRef<Elf_Shdr> Sections, const Elf_Shdr *Symtab) { FirstGlobal = Symtab->sh_info; @@ -281,6 +276,12 @@ ObjFile<ELFT>::ObjFile(MemoryBufferRef M, StringRef ArchiveName) this->ArchiveName = ArchiveName; } +template <class ELFT> +uint32_t ObjFile<ELFT>::getSectionIndex(const Elf_Sym &Sym) const { + return CHECK(this->getObj().getSectionIndex(&Sym, this->ELFSyms, SymtabSHNDX), + this); +} + template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getLocalSymbols() { if (this->Symbols.empty()) return {}; @@ -890,9 +891,6 @@ template <class ELFT> void SharedFile<ELFT>::parseDynamic() { 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; diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index fe8f0f88c7f..755c1531e90 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -161,15 +161,12 @@ public: 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<Elf_Sym> ELFSyms; uint32_t FirstGlobal = 0; - ArrayRef<Elf_Word> SymtabSHNDX; StringRef StringTable; void initSymtab(ArrayRef<Elf_Shdr> Sections, const Elf_Shdr *Symtab); }; @@ -202,6 +199,8 @@ public: return *this->Symbols[SymbolIndex]; } + uint32_t getSectionIndex(const Elf_Sym &Sym) const; + template <typename RelT> Symbol &getRelocTargetSym(const RelT &Rel) const { uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL); return getSymbol(SymIndex); @@ -247,6 +246,8 @@ private: bool shouldMerge(const Elf_Shdr &Sec); Symbol *createSymbol(const Elf_Sym *Sym); + ArrayRef<Elf_Word> SymtabSHNDX; + // .shstrtab contents. StringRef SectionStringTable; |