summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-04-30 23:01:58 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-04-30 23:01:58 +0000
commit30481e275c63e0d406abe5c4f6addcf403bc1b39 (patch)
tree4fc47a3ab1dd9f240542ba5a67ce84afc711ebbc /llvm/lib
parenta08869355717369b38cf75f2c80961198f5fce2c (diff)
downloadbcm5719-llvm-30481e275c63e0d406abe5c4f6addcf403bc1b39.tar.gz
bcm5719-llvm-30481e275c63e0d406abe5c4f6addcf403bc1b39.zip
Set FnEnd in JITEmitter::finishFunction to point strictly to the end of function's machine code.
Don't include memory allocated for global variables during relocations resolution. llvm-svn: 70517
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
index afb89e7fb38..7356df4e4f7 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -1051,6 +1051,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
unsigned char *FnStart =
(unsigned char *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction());
+ // FnEnd is the end of the function's machine code.
+ unsigned char *FnEnd = CurBufferPtr;
+
if (!Relocations.empty()) {
CurFn = F.getFunction();
NumRelos += Relocations.size();
@@ -1128,9 +1131,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
}
}
- unsigned char *FnEnd = CurBufferPtr;
-
- MemMgr->endFunctionBody(F.getFunction(), BufferBegin, FnEnd);
+ // CurBufferPtr may have moved beyond FnEnd, due to memory allocation for
+ // global variables that were referenced in the relocations.
+ MemMgr->endFunctionBody(F.getFunction(), BufferBegin, CurBufferPtr);
if (CurBufferPtr == BufferEnd) {
// FIXME: Allocate more space, then try again.
OpenPOWER on IntegriCloud