From 06a78d0d88cc041668aff2fe0e58032e4433d7ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 9 Mar 2021 18:29:32 +0100 Subject: [PATCH] runtime_loader: set default alignment to max_align_t if available ...as done by mmlr in malloc_debug. TLS blocks are expected to be aligned, gcc happily uses SSE instructions, triggering exceptions. Change-Id: I5a7bfe287600286e724cd13fe9aa7c7916091979 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3768 Reviewed-by: Adrien Destugues --- src/system/runtime_loader/heap.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/runtime_loader/heap.cpp b/src/system/runtime_loader/heap.cpp index ee358f06e1..fe88578338 100644 --- a/src/system/runtime_loader/heap.cpp +++ b/src/system/runtime_loader/heap.cpp @@ -36,7 +36,12 @@ To ease list handling, the list anchor itself is a free chunk with size 0 that can't be allocated. */ +#if __cplusplus >= 201103L +#include +const static size_t kAlignment = alignof(max_align_t); +#else const static size_t kAlignment = 8; +#endif // all memory chunks will be a multiple of this const static size_t kInitialHeapSize = 64 * 1024;