summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-08-15 20:53:52 +0000
committerSean Callanan <scallanan@apple.com>2012-08-15 20:53:52 +0000
commit219fc0f38643ec02d55ecea39c4270066e1fd136 (patch)
treea825037108171c979face43e369f9a9c5ceee28e /llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
parent3697143a0b78cb907be93231bd58c10da17c8162 (diff)
downloadbcm5719-llvm-219fc0f38643ec02d55ecea39c4270066e1fd136.tar.gz
bcm5719-llvm-219fc0f38643ec02d55ecea39c4270066e1fd136.zip
Fixed a problem in the JIT memory allocator where
allocations of executable memory would not be padded to account for the size of the allocation header. This resulted in undersized allocations, meaning that when the allocation was written to later the next allocation's header would be corrupted. llvm-svn: 161984
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
index 7be6ef8cba9..61bc119d305 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
@@ -461,6 +461,9 @@ namespace {
/// allocateCodeSection - Allocate memory for a code section.
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID) {
+ // Grow the required block size to account for the block header
+ Size += sizeof(*CurBlock);
+
// FIXME: Alignement handling.
FreeRangeHeader* candidateBlock = FreeMemoryList;
FreeRangeHeader* head = FreeMemoryList;
OpenPOWER on IntegriCloud