summaryrefslogtreecommitdiff
path: root/linker/linker_allocator.cpp
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-01-21 10:55:40 -0800
committerDimitry Ivanov <dimitry@google.com>2016-01-21 14:28:33 -0800
commit3edc5c41bbee7cf608a781e7056599f32ca1949c (patch)
tree88b26c5a450fb4548479c109a68253e7a41c07e8 /linker/linker_allocator.cpp
parent8d6e19408cfdbd73ba7e5c9e5b8716d9dad8dcf9 (diff)
linker: align allocated blocks to 16 bytes
C/C++ requires the result of malloc/new to be aligned for any primitive type. Change-Id: I715b7679e738f34b3b409993fb3ef242e1321b7f
Diffstat (limited to 'linker/linker_allocator.cpp')
-rw-r--r--linker/linker_allocator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp
index 1b16cf12c..76ec97005 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_allocator.cpp
@@ -189,6 +189,8 @@ void LinkerSmallObjectAllocator::create_page_record(void* page_addr, size_t free
}
void LinkerSmallObjectAllocator::alloc_page() {
+ static_assert(sizeof(page_info) % 16 == 0,
+ "sizeof(page_info) is not multiple of 16");
void* map_ptr = mmap(nullptr, PAGE_SIZE,
PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
if (map_ptr == MAP_FAILED) {