mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-11 20:27:19 +00:00
ELF: Move SymtabSHNDX and getSectionIndex() to ObjFile. NFCI.
Differential Revision: https://reviews.llvm.org/D60244 llvm-svn: 357670
This commit is contained in:
parent
f5de7ad211
commit
8238604259
@ -258,11 +258,6 @@ typename ELFT::SymRange ELFFileBase<ELFT>::getGlobalELFSyms() {
|
||||
return makeArrayRef(ELFSyms.begin() + FirstGlobal, ELFSyms.end());
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user