Skip to content

Commit 59aebc5

Browse files
committed
cmake: group arch specific handling
Signed-off-by: Axel Heider <[email protected]>
1 parent fd0a5ec commit 59aebc5

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

cmake-tool/helpers/environment_flags.cmake

+25-20
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,34 @@ macro(add_default_compilation_options)
4646

4747
if(KernelArchX86)
4848
add_compile_options(-mtls-direct-seg-refs)
49-
endif()
5049

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

55-
# Don't allow unaligned data store/load instructions as this will cause an alignment
56-
# fault on any seL4 memory regions that are uncached as the mapping attributes the kernel
57-
# uses causes alignment checks to be enabled.
58-
if(KernelSel4ArchAarch64)
59-
add_compile_options(-mstrict-align)
60-
if(NOT CMAKE_C_COMPILER_VERSION)
61-
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION is not set")
62-
endif()
63-
# special handling for GCC 10 and above
64-
if(
65-
(CMAKE_C_COMPILER_ID STREQUAL "GNU")
66-
AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
67-
)
68-
add_compile_options(-mno-outline-atomics)
60+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
61+
if(NOT CMAKE_C_COMPILER_VERSION)
62+
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION is not set")
63+
elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
64+
# special handling for GCC 10 and above
65+
add_compile_options(-mno-outline-atomics)
66+
endif()
67+
endif()
68+
else()
69+
message(FATAL_ERROR "unknown ARM KernelSel4Arch '${KernelSel4Arch}'")
6970
endif()
70-
elseif(KernelSel4ArchAarch32)
71-
add_compile_options(-mno-unaligned-access)
71+
72+
elseif(KernelArchRiscV)
73+
# nothing special
74+
75+
else()
76+
message(FATAL_ERROR "unknown KernelArch '${KernelArch}'")
7277
endif()
7378
endmacro()
7479

0 commit comments

Comments
 (0)