[PATCH] D60244: ELF: Move SymtabSHNDX and getSectionIndex() to ObjFile. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 20:12:24 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD357670: ELF: Move SymtabSHNDX and getSectionIndex() to ObjFile. NFCI. (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D60244?vs=193645&id=193648#toc
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60244/new/
https://reviews.llvm.org/D60244
Files:
ELF/InputFiles.cpp
ELF/InputFiles.h
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -259,11 +259,6 @@
}
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 @@
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 @@
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;
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<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 @@
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 @@
bool shouldMerge(const Elf_Shdr &Sec);
Symbol *createSymbol(const Elf_Sym *Sym);
+ ArrayRef<Elf_Word> SymtabSHNDX;
+
// .shstrtab contents.
StringRef SectionStringTable;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60244.193648.patch
Type: text/x-patch
Size: 2270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190404/5affbdbc/attachment.bin>
More information about the llvm-commits
mailing list