summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Object/ELF.h12
-rw-r--r--llvm/include/llvm/Object/ELFTypes.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h
index 8b28567f72c..ae0e7376245 100644
--- a/llvm/include/llvm/Object/ELF.h
+++ b/llvm/include/llvm/Object/ELF.h
@@ -227,6 +227,8 @@ public:
ArchivePointerTypeTraits<const char> > Current;
};
+ typedef iterator_range<Elf_Sym_Iter> Elf_Sym_Range;
+
private:
typedef SmallVector<const Elf_Shdr *, 2> Sections_t;
typedef DenseMap<unsigned, unsigned> IndexMap_t;
@@ -340,6 +342,9 @@ public:
Elf_Sym_Iter begin_symbols() const;
Elf_Sym_Iter end_symbols() const;
+ Elf_Sym_Range symbols() const {
+ return make_range(begin_symbols(), end_symbols());
+ }
Elf_Dyn_Iter begin_dynamic_table() const;
/// \param NULLEnd use one past the first DT_NULL entry as the end instead of
@@ -424,6 +429,7 @@ public:
const Elf_Sym *getSymbol(uint32_t index) const;
ErrorOr<StringRef> getSymbolName(Elf_Sym_Iter Sym) const;
+ ErrorOr<StringRef> getStaticSymbolName(const Elf_Sym *Symb) const;
/// \brief Get the name of \p Symb.
/// \param SymTab The symbol table section \p Symb is contained in.
@@ -962,6 +968,12 @@ ErrorOr<StringRef> ELFFile<ELFT>::getSymbolName(Elf_Sym_Iter Sym) const {
}
template <class ELFT>
+ErrorOr<StringRef>
+ELFFile<ELFT>::getStaticSymbolName(const Elf_Sym *Symb) const {
+ return getSymbolName(dot_symtab_sec, Symb);
+}
+
+template <class ELFT>
ErrorOr<StringRef> ELFFile<ELFT>::getSymbolName(const Elf_Shdr *Section,
const Elf_Sym *Symb) const {
if (Symb->st_name == 0)
diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h
index 70f6d8b930b..ea54cac36d1 100644
--- a/llvm/include/llvm/Object/ELFTypes.h
+++ b/llvm/include/llvm/Object/ELFTypes.h
@@ -197,6 +197,9 @@ struct Elf_Sym_Impl : Elf_Sym_Base<ELFT> {
return st_shndx >= ELF::SHN_LORESERVE;
}
bool isUndefined() const { return st_shndx == ELF::SHN_UNDEF; }
+ bool isExternal() const {
+ return getBinding() != ELF::STB_LOCAL;
+ }
};
/// Elf_Versym: This is the structure of entries in the SHT_GNU_versym section
OpenPOWER on IntegriCloud