Skip to content
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
63 changes: 36 additions & 27 deletions cmake-tool/helpers/environment_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,45 @@ macro(add_default_compilation_options)

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

if(KernelSel4ArchAarch32)
# The arm-gnu-eabi* uses TPIDRURO as the default tls register.
# If this isn't what the kernel is configured to, generate function calls for
# thread pointer access.
if (NOT KernelArmTLSRegTPIDRURO)
add_compile_options(-mtp=soft)
endif()
endif()
elseif(KernelArchARM)
if(KernelSel4ArchAarch32)
add_compile_options(-mno-unaligned-access)
# The arm-gnu-eabi* uses TPIDRURO as the default tls register.
# If this isn't what the kernel is configured to, generate function
# calls for thread pointer access.
if (NOT KernelArmTLSRegTPIDRURO)
add_compile_options(-mtp=soft)
endif()

# 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"))
OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang")
AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))
)
add_compile_options(-mno-outline-atomics)
elseif(KernelSel4ArchAarch64)
# 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.
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"))
OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang")
AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))
)
add_compile_options(-mno-outline-atomics)
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
Loading