mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
Convert obj->getSymbolName to sym->getName.
I doesn't depend on the object anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240996 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -371,7 +371,6 @@ public:
|
||||
///
|
||||
/// \p SymTab is used to lookup the string table to use to get the symbol's
|
||||
/// name.
|
||||
ErrorOr<StringRef> getSymbolName(StringRef StrTab, const Elf_Sym *Symb) const;
|
||||
ErrorOr<StringRef> getSectionName(const Elf_Shdr *Section) const;
|
||||
uint64_t getSymbolIndex(const Elf_Sym *sym) const;
|
||||
ErrorOr<ArrayRef<uint8_t> > getSectionContents(const Elf_Shdr *Sec) const;
|
||||
@@ -881,7 +880,7 @@ const char *ELFFile<ELFT>::getDynamicString(uintX_t Offset) const {
|
||||
template <class ELFT>
|
||||
ErrorOr<StringRef>
|
||||
ELFFile<ELFT>::getStaticSymbolName(const Elf_Sym *Symb) const {
|
||||
return getSymbolName(DotStrtab, Symb);
|
||||
return Symb->getName(DotStrtab);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
@@ -898,15 +897,6 @@ ErrorOr<StringRef> ELFFile<ELFT>::getSymbolName(const Elf_Sym *Symb,
|
||||
return getStaticSymbolName(Symb);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
ErrorOr<StringRef> ELFFile<ELFT>::getSymbolName(StringRef StrTab,
|
||||
const Elf_Sym *Sym) const {
|
||||
uint32_t Offset = Sym->st_name;
|
||||
if (Offset >= StrTab.size())
|
||||
return object_error::parse_failed;
|
||||
return StringRef(StrTab.data() + Offset);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
ErrorOr<StringRef>
|
||||
ELFFile<ELFT>::getSectionName(const Elf_Shdr *Section) const {
|
||||
@@ -932,7 +922,7 @@ ErrorOr<StringRef> ELFFile<ELFT>::getSymbolVersion(const Elf_Shdr *section,
|
||||
// Non-dynamic symbols can have versions in their names
|
||||
// A name of the form 'foo@V1' indicates version 'V1', non-default.
|
||||
// A name of the form 'foo@@V2' indicates version 'V2', default version.
|
||||
ErrorOr<StringRef> SymName = getSymbolName(StrTab, symb);
|
||||
ErrorOr<StringRef> SymName = symb->getName(StrTab);
|
||||
if (!SymName)
|
||||
return SymName;
|
||||
StringRef Name = *SymName;
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
#ifndef LLVM_OBJECT_ELFTYPES_H
|
||||
#define LLVM_OBJECT_ELFTYPES_H
|
||||
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace object {
|
||||
@@ -205,8 +207,18 @@ struct Elf_Sym_Impl : Elf_Sym_Base<ELFT> {
|
||||
bool isExternal() const {
|
||||
return getBinding() != ELF::STB_LOCAL;
|
||||
}
|
||||
|
||||
ErrorOr<StringRef> getName(StringRef StrTab) const;
|
||||
};
|
||||
|
||||
template <class ELFT>
|
||||
ErrorOr<StringRef> Elf_Sym_Impl<ELFT>::getName(StringRef StrTab) const {
|
||||
uint32_t Offset = this->st_name;
|
||||
if (Offset >= StrTab.size())
|
||||
return object_error::parse_failed;
|
||||
return StringRef(StrTab.data() + Offset);
|
||||
}
|
||||
|
||||
/// Elf_Versym: This is the structure of entries in the SHT_GNU_versym section
|
||||
/// (.gnu.version). This structure is identical for ELF32 and ELF64.
|
||||
template <class ELFT>
|
||||
|
||||
Reference in New Issue
Block a user