Skip to content

Commit

Permalink
Fix RISC-V compilation with recent GCC (seL4#171)
Browse files Browse the repository at this point in the history
* 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 seL4/seL4#776

Signed-off-by: Peter Chubb <[email protected]>
  • Loading branch information
wom-bat authored Jul 13, 2023
1 parent 2c61d6a commit a9d1b6d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmake-tool/helpers/rootserver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a9d1b6d

Please sign in to comment.