const object::ELFFile<ELFT> &Obj;
- std::error_code dumpSymbol(const Elf_Sym *Sym, ELFYAML::Symbol &S);
+ std::error_code dumpSymbol(const Elf_Sym *Sym, StringRef StrTable,
+ ELFYAML::Symbol &S);
std::error_code dumpCommonSection(const Elf_Shdr *Shdr, ELFYAML::Section &S);
std::error_code dumpCommonRelocationSection(const Elf_Shdr *Shdr,
ELFYAML::RelocationSection &S);
}
// Dump symbols
+ const Elf_Shdr *Symtab = Obj.getDotSymtabSec();
+ ErrorOr<StringRef> StrTableOrErr = Obj.getStringTableForSymtab(*Symtab);
+ if (std::error_code EC = StrTableOrErr.getError())
+ return EC;
+ StringRef StrTable = *StrTableOrErr;
+
bool IsFirstSym = true;
for (const Elf_Sym &Sym : Obj.symbols()) {
if (IsFirstSym) {
}
ELFYAML::Symbol S;
- if (std::error_code EC = ELFDumper<ELFT>::dumpSymbol(&Sym, S))
+ if (std::error_code EC = ELFDumper<ELFT>::dumpSymbol(&Sym, StrTable, S))
return EC;
switch (Sym.getBinding())
template <class ELFT>
std::error_code ELFDumper<ELFT>::dumpSymbol(const Elf_Sym *Sym,
+ StringRef StrTable,
ELFYAML::Symbol &S) {
S.Type = Sym->getType();
S.Value = Sym->st_value;
S.Size = Sym->st_size;
S.Other = Sym->st_other;
- ErrorOr<StringRef> NameOrErr = Obj.getStaticSymbolName(Sym);
+ ErrorOr<StringRef> NameOrErr = Sym->getName(StrTable);
if (std::error_code EC = NameOrErr.getError())
return EC;
S.Name = NameOrErr.get();