diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-07-28 12:44:13 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-07-28 12:44:13 +0000 |
commit | 6a9746127a168306a670eaff11925605dbea9d4f (patch) | |
tree | 56a2b1ef8b41c868fc5a5f9d452ed70511c14bba /lib/ExecutionEngine/JIT/JIT.cpp | |
parent | 988b1dd608ed596879e29ad27d4aafdbf3a8f1ac (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r-- | lib/ExecutionEngine/JIT/JIT.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 3907511750..1e879a9166 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/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); |