From a9d1b6d2b127830d6205e46c983d63e5bb561449 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Thu, 13 Jul 2023 19:42:55 +1000 Subject: [PATCH] Fix RISC-V compilation with recent GCC (#171) * Fix RISC-V compilation with recent GCC Default args for gcc have changed; we need to fix the args given to the compiler. This is needed in addition to https://github.com/seL4/seL4/pull/776 Signed-off-by: Peter Chubb --- cmake-tool/helpers/rootserver.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake-tool/helpers/rootserver.cmake b/cmake-tool/helpers/rootserver.cmake index 6d902ec4..4a5139e4 100644 --- a/cmake-tool/helpers/rootserver.cmake +++ b/cmake-tool/helpers/rootserver.cmake @@ -111,6 +111,19 @@ function(DeclareRootserver rootservername) if(NOT OPENSBI_PLAT_ISA) set(OPENSBI_PLAT_ISA "rv${OPENSBI_PLAT_XLEN}imafdc") + + # 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 OPENSBI_PLAT_ISA "_zicsr_zifencei") + endif() endif() if(NOT OPENSBI_PLAT_ABI)