summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit4612fed911f5ef5c14158f960cab06fdff200dab (patch)
treecbc550f72284cbddb19b8bf5d22f6a98a4be36f8 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
parentf708c87078a8a3c5075d9a5a1c2f25c3618f6dbc (diff)
downloadbcm5719-llvm-4612fed911f5ef5c14158f960cab06fdff200dab.tar.gz
bcm5719-llvm-4612fed911f5ef5c14158f960cab06fdff200dab.zip
Adding PIC support for ELF on x86_64 platforms
llvm-svn: 188726
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index a00b951e0a8..d36126a9e2d 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/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");
OpenPOWER on IntegriCloud