forked from Imagelibrary/seL4
cmake: fix build when using GNU binutils >= 2.38
GNU binutils require specifying the Zicsr and Zifencei extensions explicitly from version 2.38 onwards. Since both are needed for building the kernel, we need to add a check for that. We only check for the GCC version being >= 11.3, since that is the first GCC version that ships with binutils 2.38 by default. Check PR #776 for more information. Signed-off-by: Florian Hofhammer <florian.hofhammer@fhofhammer.de>
This commit is contained in:
committed by
Gerwin Klein
parent
ab32a37398
commit
c3e353955d
@@ -124,6 +124,17 @@ elseif(KernelArchRiscV)
|
||||
# enabled
|
||||
string(APPEND _riscv_march "c")
|
||||
|
||||
# Determine if GNU toolchain is used and if yes, whether GCC version >= 11.3 (implies binutils version >= 2.38)
|
||||
if(
|
||||
CMAKE_ASM_COMPILER_ID STREQUAL "GNU"
|
||||
AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "11.3"
|
||||
)
|
||||
# Manually enable Zicsr and Zifencei extensions
|
||||
# This became necessary due to a change in the default ISA version in GNU binutils 2.38 which is the
|
||||
# default binutils version shipped with GCC 11.3
|
||||
string(APPEND _riscv_march "_zicsr_zifencei")
|
||||
endif()
|
||||
|
||||
string(APPEND common_flags " -march=${_riscv_march} -mabi=${_riscv_mabi}")
|
||||
|
||||
else()
|
||||
|
||||
Reference in New Issue
Block a user