mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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
Notes:
sideshowbarker
2024-07-18 08:55:04 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/c176680443e Pull-request: https://github.com/SerenityOS/serenity/pull/8772
1 changed files with 2 additions and 0 deletions
|
@ -356,8 +356,10 @@ endif()
|
||||||
|
|
||||||
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
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} -mcmodel=large -fno-pic -mno-red-zone")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new=8")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new=4")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Kernel Undefined Behavior Sanitizer (KUBSAN)
|
# Kernel Undefined Behavior Sanitizer (KUBSAN)
|
||||||
|
|
Loading…
Reference in a new issue