mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Replace the last uses of ELF::getSymbolName in llvm-readobj.
llvm-svn: 242798
This commit is contained in:
parent
d93aba13d6
commit
baa0c22119
@ -237,6 +237,9 @@ public:
|
||||
const Elf_Shdr *getDotSymtabSec() const { return dot_symtab_sec; }
|
||||
const Elf_Shdr *getDotDynSymSec() const { return DotDynSymSec; }
|
||||
const Elf_Hash *getHashTable() const { return HashTable; }
|
||||
StringRef getDynamicStringTable() const {
|
||||
return StringRef((const char *)DynStrRegion.Addr, DynStrRegion.Size);
|
||||
}
|
||||
|
||||
ErrorOr<StringRef> getStringTable(const Elf_Shdr *Section) const;
|
||||
ErrorOr<StringRef> getStringTableForSymtab(const Elf_Shdr &Section) const;
|
||||
|
@ -344,10 +344,15 @@ template <typename ET>
|
||||
ErrorOr<StringRef>
|
||||
PrinterContext<ET>::FunctionAtAddress(unsigned Section,
|
||||
uint64_t Address) const {
|
||||
const Elf_Shdr *Symtab = ELF->getDotSymtabSec();
|
||||
ErrorOr<StringRef> StrTableOrErr = ELF->getStringTableForSymtab(*Symtab);
|
||||
error(StrTableOrErr.getError());
|
||||
StringRef StrTable = *StrTableOrErr;
|
||||
|
||||
for (const Elf_Sym &Sym : ELF->symbols())
|
||||
if (Sym.st_shndx == Section && Sym.st_value == Address &&
|
||||
Sym.getType() == ELF::STT_FUNC)
|
||||
return ELF->getSymbolName(&Sym, false);
|
||||
return Sym.getName(StrTable);
|
||||
return readobj_error::unknown_symbol;
|
||||
}
|
||||
|
||||
|
@ -695,13 +695,14 @@ template<class ELFT>
|
||||
void ELFDumper<ELFT>::printDynamicRelocations() {
|
||||
W.startLine() << "Dynamic Relocations {\n";
|
||||
W.indent();
|
||||
StringRef StringTable = Obj->getDynamicStringTable();
|
||||
for (const typename ELFO::Elf_Rela &Rel : Obj->dyn_relas()) {
|
||||
SmallString<32> RelocName;
|
||||
Obj->getRelocationTypeName(Rel.getType(Obj->isMips64EL()), RelocName);
|
||||
StringRef SymbolName;
|
||||
uint32_t SymIndex = Rel.getSymbol(Obj->isMips64EL());
|
||||
const typename ELFO::Elf_Sym *Sym = Obj->dynamic_symbol_begin() + SymIndex;
|
||||
SymbolName = errorOrDefault(Obj->getSymbolName(Sym, true));
|
||||
SymbolName = errorOrDefault(Sym->getName(StringTable));
|
||||
if (opts::ExpandRelocs) {
|
||||
DictScope Group(W, "Relocation");
|
||||
W.printHex("Offset", Rel.r_offset);
|
||||
|
Loading…
Reference in New Issue
Block a user