Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: group arch specific handling #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions cmake-tool/helpers/environment_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,34 @@ macro(add_default_compilation_options)

if(KernelArchX86)
add_compile_options(-mtls-direct-seg-refs)
endif()

if(KernelSel4ArchAarch32)
add_compile_options(-mtp=soft)
endif()
elseif(KernelArchARM)
if(KernelSel4ArchAarch32)
add_compile_options(-mtp=soft -mno-unaligned-access)
elseif(KernelSel4ArchAarch64)
# Don't allow unaligned data store/load instructions, This will
# cause an alignment fault on any uncached seL4 memory regions,
# because the kernel enabled alignment checks inm the mapping
# attributes.
add_compile_options(-mstrict-align)

# Don't allow unaligned data store/load instructions as this will cause an alignment
# fault on any seL4 memory regions that are uncached as the mapping attributes the kernel
# uses causes alignment checks to be enabled.
if(KernelSel4ArchAarch64)
add_compile_options(-mstrict-align)
if(NOT CMAKE_C_COMPILER_VERSION)
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION is not set")
endif()
# special handling for GCC 10 and above
if(
(CMAKE_C_COMPILER_ID STREQUAL "GNU")
AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
)
add_compile_options(-mno-outline-atomics)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(NOT CMAKE_C_COMPILER_VERSION)
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION is not set")
elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
# special handling for GCC 10 and above
add_compile_options(-mno-outline-atomics)
endif()
endif()
else()
message(FATAL_ERROR "unknown ARM KernelSel4Arch '${KernelSel4Arch}'")
endif()
elseif(KernelSel4ArchAarch32)
add_compile_options(-mno-unaligned-access)

elseif(KernelArchRiscV)
# nothing special

else()
message(FATAL_ERROR "unknown KernelArch '${KernelArch}'")
endif()
endmacro()

Expand Down