summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-10-17 23:54:46 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-10-17 23:54:46 +0000
commit321731539e9fd4b20a69c7e14a42ccc694476b14 (patch)
treec4f872ecaa8f0de6787b5b6000dc1e5be3334744 /llvm/lib/Object/MachOObjectFile.cpp
parent017597540e645ee69b336802d30c0e52f8a575d9 (diff)
downloadbcm5719-llvm-321731539e9fd4b20a69c7e14a42ccc694476b14.tar.gz
bcm5719-llvm-321731539e9fd4b20a69c7e14a42ccc694476b14.zip
Object: Add isSymbolAbsolute and getSymbolSection.
llvm-svn: 142317
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index c757dd35907..472e0727c33 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -242,6 +242,43 @@ error_code MachOObjectFile::isSymbolWeak(DataRefImpl Symb, bool &Res) const {
return object_error::success;
}
+error_code MachOObjectFile::isSymbolAbsolute(DataRefImpl Symb, bool &Res) const{
+ uint8_t n_type;
+ if (MachOObj->is64Bit()) {
+ InMemoryStruct<macho::Symbol64TableEntry> Entry;
+ getSymbol64TableEntry(Symb, Entry);
+ n_type = Entry->Type;
+ } else {
+ InMemoryStruct<macho::SymbolTableEntry> Entry;
+ getSymbolTableEntry(Symb, Entry);
+ n_type = Entry->Type;
+ }
+
+ Res = (n_type & MachO::NlistMaskType) == MachO::NListTypeAbsolute;
+ return object_error::success;
+}
+
+error_code MachOObjectFile::getSymbolSection(DataRefImpl Symb,
+ section_iterator &Res) const {
+ uint8_t index;
+ if (MachOObj->is64Bit()) {
+ InMemoryStruct<macho::Symbol64TableEntry> Entry;
+ getSymbol64TableEntry(Symb, Entry);
+ index = Entry->SectionIndex;
+ } else {
+ InMemoryStruct<macho::SymbolTableEntry> Entry;
+ getSymbolTableEntry(Symb, Entry);
+ index = Entry->SectionIndex;
+ }
+
+ if (index == 0)
+ Res = end_sections();
+ else
+ Res = section_iterator(SectionRef(Sections[index], this));
+
+ return object_error::success;
+}
+
error_code MachOObjectFile::getSymbolType(DataRefImpl Symb,
SymbolRef::Type &Res) const {
uint8_t n_type;
OpenPOWER on IntegriCloud