summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2013-08-19 23:27:43 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2013-08-19 23:27:43 +0000
commitff9fa05905be716435460b5f6d32689041bf895b (patch)
treecf87025702b9a29ac6712f99993b445880b2ad1d /lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
parentabd37961d55680e5e946b9e336ce14b4ac56f830 (diff)
downloadllvm-ff9fa05905be716435460b5f6d32689041bf895b.tar.gz
llvm-ff9fa05905be716435460b5f6d32689041bf895b.tar.bz2
llvm-ff9fa05905be716435460b5f6d32689041bf895b.tar.xz
Adding PIC support for ELF on x86_64 platforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index a00b951e0a..d36126a9e2 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -169,6 +169,9 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
}
}
+ // Give the subclasses a chance to tie-up any loose ends.
+ finalizeLoad();
+
return obj.take();
}
@@ -424,6 +427,10 @@ uint8_t *RuntimeDyldImpl::createStubFunction(uint8_t *Addr) {
writeInt16BE(Addr+6, 0x07F1); // brc 15,%r1
// 8-byte address stored at Addr + 8
return Addr;
+ } else if (Arch == Triple::x86_64) {
+ *Addr = 0xFF; // jmp
+ *(Addr+1) = 0x25; // rip
+ // 32-bit PC-relative address of the GOT entry will be stored at Addr+2
}
return Addr;
}
@@ -473,6 +480,7 @@ void RuntimeDyldImpl::resolveExternalSymbols() {
// MemoryManager.
uint8_t *Addr = (uint8_t*) MemMgr->getPointerToNamedFunction(Name.data(),
true);
+ updateGOTEntries(Name, (uint64_t)Addr);
DEBUG(dbgs() << "Resolving relocations Name: " << Name
<< "\t" << format("%p", Addr)
<< "\n");