CMake: Add -mstrict-align flag to compile options for aarch64 build
The aarch64 processor is set up to trap on unaligned memory accesses, so to enforce that the compiler correctly generates aligned accesses, the -mstrict-align flag is needed. We also need the -Wno-cast-align as there are some files in AK that don't build without the flag.
This commit is contained in:
parent
d5262a540c
commit
dfc6555fec
Notes:
sideshowbarker
2024-07-17 05:41:34 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/dfc6555fec Pull-request: https://github.com/SerenityOS/serenity/pull/17258 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/nico ✅
1 changed files with 7 additions and 0 deletions
|
@ -52,3 +52,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|||
# Clang doesn't add compiler_rt to the search path when compiling with -nostdlib.
|
||||
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/)
|
||||
endif()
|
||||
|
||||
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
||||
# Unaligned memory access will cause a trap, so to make sure the compiler doesn't generate
|
||||
# those unaligned accesses, the strict-align flag is added.
|
||||
# FIXME: Remove -Wno-cast-align when we are able to build everything without this warning turned on.
|
||||
add_compile_options(-mstrict-align -Wno-cast-align)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Reference in a new issue