Skip to content
Permalink
Browse files

riscv: toolchain arguments for a 64-bit build

For now we enforce the medany code model for 64-bit builds as we get
reloc issues otherwise. The instruction set and ABI are also set to
soft-float usage.

The ilp32 ABI is explicitly specified on 32-bit build to make sure
it is not using a wrong default if the same toolchain is used for both
32- and 64-bit builds. The archittecture options are the same as the
SDK's riscv32 toolchain default in that case.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
  • Loading branch information...
Nicolas Pitre authored and galak committed Jul 26, 2019
1 parent 55c3585 commit c351492bc7939b45276bc0ef81224d59e4caadb1
Showing with 10 additions and 0 deletions.
  1. +4 −0 arch/riscv/CMakeLists.txt
  2. +6 −0 cmake/compiler/gcc/target.cmake
@@ -2,4 +2,8 @@

add_subdirectory(core)

if(CONFIG_64BIT)
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf64-littleriscv)
else()
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-littleriscv)
endif()
@@ -69,6 +69,12 @@ elseif("${ARCH}" STREQUAL "arc")
list(APPEND TOOLCHAIN_C_FLAGS
-mcpu=${GCC_M_CPU}
)
elseif("${ARCH}" STREQUAL "riscv")
if(CONFIG_64BIT)
list(APPEND TOOLCHAIN_C_FLAGS -mabi=lp64 -march=rv64imac -mcmodel=medany)
else()
list(APPEND TOOLCHAIN_C_FLAGS -mabi=ilp32 -march=rv32ima)
endif()
endif()

if(NOT no_libgcc)

0 comments on commit c351492

Please sign in to comment.
You can’t perform that action at this time.