summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2005-07-28 12:44:13 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2005-07-28 12:44:13 +0000
commit3444cf5128167fce268afcdae56882c8ab50a7ed (patch)
treebc794878da352f6e713075563b504c6e0271b018 /llvm/lib/ExecutionEngine/JIT/JIT.cpp
parenta8195603e41113ff648b51c5137e2fb4fa10913a (diff)
downloadbcm5719-llvm-3444cf5128167fce268afcdae56882c8ab50a7ed.tar.gz
bcm5719-llvm-3444cf5128167fce268afcdae56882c8ab50a7ed.zip
Like constants, globals on some platforms are GOT relative. This means they have to be allocated
near the GOT, which new doesn't do. So break out the allocate into a new function. Also move GOT index handling into JITResolver. This lets it update the mapping when a Lazy function is JITed. It doesn't managed the table, just the mapping. Note that this is still non-ideal, as any function that takes a function address should also take a GOT index, but that is a lot of changes. The relocation resolve process updates any GOT entry it sees is out of date. llvm-svn: 22537
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index 39075117509..1e879a9166b 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -294,7 +294,8 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) {
// actually initialize the global after current function has finished
// compilation.
uint64_t S = getTargetData().getTypeSize(GV->getType()->getElementType());
- Ptr = new char[(size_t)S];
+ unsigned char A = getTargetData().getTypeAlignment(GV->getType()->getElementType());
+ Ptr = MCE->allocateGlobal(S, A);
state.getPendingGlobals(locked).push_back(GV);
}
addGlobalMapping(GV, Ptr);
OpenPOWER on IntegriCloud