mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
llvm-readobj: use the associated string table to print symbols. NFI.
This just removes some cases that require ELFFile to eagerly parse the ELF file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242794 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -239,6 +239,8 @@ public:
|
||||
const Elf_Hash *getHashTable() const { return HashTable; }
|
||||
|
||||
ErrorOr<StringRef> getStringTable(const Elf_Shdr *Section) const;
|
||||
ErrorOr<StringRef> getStringTableForSymtab(const Elf_Shdr &Section) const;
|
||||
|
||||
const char *getDynamicString(uintX_t Offset) const;
|
||||
ErrorOr<StringRef> getSymbolVersion(const Elf_Shdr *section,
|
||||
const Elf_Sym *Symb,
|
||||
@@ -646,10 +648,7 @@ ELFFile<ELFT>::ELFFile(StringRef Object, std::error_code &EC)
|
||||
return;
|
||||
}
|
||||
dot_symtab_sec = &Sec;
|
||||
ErrorOr<const Elf_Shdr *> SectionOrErr = getSection(Sec.sh_link);
|
||||
if ((EC = SectionOrErr.getError()))
|
||||
return;
|
||||
ErrorOr<StringRef> SymtabOrErr = getStringTable(*SectionOrErr);
|
||||
ErrorOr<StringRef> SymtabOrErr = getStringTableForSymtab(Sec);
|
||||
if ((EC = SymtabOrErr.getError()))
|
||||
return;
|
||||
DotStrtab = *SymtabOrErr;
|
||||
@@ -878,6 +877,17 @@ ELFFile<ELFT>::getStringTable(const Elf_Shdr *Section) const {
|
||||
return Data;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
ErrorOr<StringRef>
|
||||
ELFFile<ELFT>::getStringTableForSymtab(const Elf_Shdr &Sec) const {
|
||||
if (Sec.sh_type != ELF::SHT_SYMTAB && Sec.sh_type != ELF::SHT_DYNSYM)
|
||||
return object_error::parse_failed;
|
||||
ErrorOr<const Elf_Shdr *> SectionOrErr = getSection(Sec.sh_link);
|
||||
if (std::error_code EC = SectionOrErr.getError())
|
||||
return EC;
|
||||
return getStringTable(*SectionOrErr);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
const char *ELFFile<ELFT>::getDynamicString(uintX_t Offset) const {
|
||||
if (Offset >= DynStrRegion.Size)
|
||||
|
Reference in New Issue
Block a user