CMake: Clean up AArch64 compiler flags

Two non-functional changes:
- Remove pointless `-latomic` flag. It was specified via
  `add_compile_options`, which only affects compilation and not linking,
  so the library was never actually linked into the kernel. In fact, we
  do not even build `libatomic` for our toolchain.
- Do not disable `-Wnonnull`. The warning-causing code was fixed at some
  point.

This commit also removes `-mstrict-align` from the userland. Our target
AArch64 hardware natively supports unaligned accesses without a
significant performance penalty. Allowing the compiler to insert
unaligned accesses into aligned-as-written code allows for some
performance optimizations in fact. We keep this option turned on in the
kernel to preserve correctness for MMIO, as that might be sensitive to
alignment.
This commit is contained in:
Daniel Bertalan 2023-08-11 12:31:20 +02:00
parent e304ba492f
commit 11896868d6
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00
2 changed files with 1 additions and 10 deletions

View File

@ -490,10 +490,7 @@ elseif("${SERENITY_ARCH}" STREQUAL "aarch64")
)
# Otherwise linker errors e.g undefined reference to `__aarch64_cas8_acq_rel'
add_compile_options(-mno-outline-atomics -latomic)
# FIXME: Remove this once compiling MemoryManager.cpp doesn't give the nonnull error anymore.
add_compile_options(-Wno-nonnull)
add_compile_options(-mno-outline-atomics)
# NOTE: These files cannot use a stack protector and sanitizers, as these will cause accesses to global variables to be inserted
# by the compiler. The CPU cannot access global variables without the MMU as the kernel is linked for a virtual address in high memory.

View File

@ -39,9 +39,3 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${LLVM_MAJOR_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()