summaryrefslogtreecommitdiff
path: root/lib/Object
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-05-12 21:39:59 +0000
committerLang Hames <lhames@gmail.com>2014-05-12 21:39:59 +0000
commitb572bc1ccfc41ae7567423843a5b88f8fba270ac (patch)
tree583925a8d52504c80c53a800f497b9a47c5f4fb1 /lib/Object
parent61248341474ae75536b64edde4debe813f21068d (diff)
downloadllvm-b572bc1ccfc41ae7567423843a5b88f8fba270ac.tar.gz
llvm-b572bc1ccfc41ae7567423843a5b88f8fba270ac.tar.bz2
llvm-b572bc1ccfc41ae7567423843a5b88f8fba270ac.tar.xz
[RuntimeDyld] Add support for MachO __jump_table and __pointers sections, and
SECTDIFF relocations on 32-bit x86. This fixes several of the MCJIT regression test failures that show up on 32-bit builds. <rdar://problem/16886294> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/MachOObjectFile.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index d0a56aa930..fa95eca669 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -1158,13 +1158,7 @@ error_code MachOObjectFile::getLibraryPath(DataRefImpl LibData,
}
basic_symbol_iterator MachOObjectFile::symbol_begin_impl() const {
- DataRefImpl DRI;
- if (!SymtabLoadCmd)
- return basic_symbol_iterator(SymbolRef(DRI, this));
-
- MachO::symtab_command Symtab = getSymtabLoadCommand();
- DRI.p = reinterpret_cast<uintptr_t>(getPtr(this, Symtab.symoff));
- return basic_symbol_iterator(SymbolRef(DRI, this));
+ return getSymbolByIndex(0);
}
basic_symbol_iterator MachOObjectFile::symbol_end_impl() const {
@@ -1182,6 +1176,20 @@ basic_symbol_iterator MachOObjectFile::symbol_end_impl() const {
return basic_symbol_iterator(SymbolRef(DRI, this));
}
+basic_symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index) const {
+ DataRefImpl DRI;
+ if (!SymtabLoadCmd)
+ return basic_symbol_iterator(SymbolRef(DRI, this));
+
+ MachO::symtab_command Symtab = getSymtabLoadCommand();
+ assert(Index < Symtab.nsyms && "Requested symbol index is out of range.");
+ unsigned SymbolTableEntrySize =
+ is64Bit() ? sizeof(MachO::nlist_64) : sizeof(MachO::nlist);
+ DRI.p = reinterpret_cast<uintptr_t>(getPtr(this, Symtab.symoff));
+ DRI.p += Index * SymbolTableEntrySize;
+ return basic_symbol_iterator(SymbolRef(DRI, this));
+}
+
section_iterator MachOObjectFile::section_begin() const {
DataRefImpl DRI;
return section_iterator(SectionRef(DRI, this));