mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:47:35 +00:00
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*)`.
This commit is contained in:
parent
860417fb4f
commit
c176680443
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue