diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-17 23:54:46 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-17 23:54:46 +0000 |
commit | 321731539e9fd4b20a69c7e14a42ccc694476b14 (patch) | |
tree | c4f872ecaa8f0de6787b5b6000dc1e5be3334744 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 017597540e645ee69b336802d30c0e52f8a575d9 (diff) | |
download | bcm5719-llvm-321731539e9fd4b20a69c7e14a42ccc694476b14.tar.gz bcm5719-llvm-321731539e9fd4b20a69c7e14a42ccc694476b14.zip |
Object: Add isSymbolAbsolute and getSymbolSection.
llvm-svn: 142317
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index a3c8248912a..a5e3910d16c 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -333,6 +333,9 @@ protected: virtual error_code isSymbolGlobal(DataRefImpl Symb, bool &Res) const; virtual error_code isSymbolWeak(DataRefImpl Symb, bool &Res) const; virtual error_code getSymbolType(DataRefImpl Symb, SymbolRef::Type &Res) const; + virtual error_code isSymbolAbsolute(DataRefImpl Symb, bool &Res) const; + virtual error_code getSymbolSection(DataRefImpl Symb, + section_iterator &Res) const; virtual error_code getSectionNext(DataRefImpl Sec, SectionRef &Res) const; virtual error_code getSectionName(DataRefImpl Sec, StringRef &Res) const; @@ -655,6 +658,32 @@ error_code ELFObjectFile<target_endianness, is64Bits> template<support::endianness target_endianness, bool is64Bits> error_code ELFObjectFile<target_endianness, is64Bits> + ::isSymbolAbsolute(DataRefImpl Symb, bool &Res) const { + validateSymbol(Symb); + const Elf_Sym *symb = getSymbol(Symb); + Res = symb->st_shndx == ELF::SHN_ABS; + return object_error::success; +} + +template<support::endianness target_endianness, bool is64Bits> +error_code ELFObjectFile<target_endianness, is64Bits> + ::getSymbolSection(DataRefImpl Symb, + section_iterator &Res) const { + validateSymbol(Symb); + const Elf_Sym *symb = getSymbol(Symb); + const Elf_Shdr *sec = getSection(symb); + if (!sec) + Res = end_sections(); + else { + DataRefImpl Sec; + Sec.p = reinterpret_cast<intptr_t>(sec); + Res = section_iterator(SectionRef(Sec, this)); + } + return object_error::success; +} + +template<support::endianness target_endianness, bool is64Bits> +error_code ELFObjectFile<target_endianness, is64Bits> ::isSymbolInternal(DataRefImpl Symb, bool &Result) const { validateSymbol(Symb); |