diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-07-15 12:05:08 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-16 20:51:13 +0200 |
commit | c176680443eb81161c888ecf023709d19745ec85 (patch) | |
tree | c795c66c1078d22004cc98eb307f6a30c2c9110d /Kernel | |
parent | 860417fb4fb9917fd08a6df2d70ab5c22935cfa8 (diff) | |
download | serenity-c176680443eb81161c888ecf023709d19745ec85.zip |
Kernel: Tell the compiler about `operator new`'s alignment
By default, the compiler will assume that `operator new` returns
pointers that are aligned correctly for every built-in type. This is not
the case in the kernel on x64, since the assumed alignment is 16
(because of long double), but the kmalloc blocks are only
`alignas(void*)`.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/CMakeLists.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 8b2ace0027..0e59bd169b 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -356,8 +356,10 @@ endif() if ("${SERENITY_ARCH}" STREQUAL "x86_64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large -fno-pic -mno-red-zone") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new=8") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new=4") endif() # Kernel Undefined Behavior Sanitizer (KUBSAN) |