cmake: llvm: riscv: Set RISC-V flags when building with clang

Ensure --target and -march/-mabi/-mcmodel are set appropriately when
building with clang targeting RISC-V.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
This commit is contained in:
Jonathon Penix 2024-01-26 14:19:08 -08:00 committed by Alberto Escolar
commit ba871733e0
2 changed files with 8 additions and 0 deletions

View file

@ -31,6 +31,8 @@ if(NOT "${ARCH}" STREQUAL "posix")
)
include(${ZEPHYR_BASE}/cmake/compiler/clang/target_arm.cmake)
elseif("${ARCH}" STREQUAL "riscv")
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_riscv.cmake)
endif()
if(DEFINED CMAKE_C_COMPILER_TARGET)

View file

@ -33,6 +33,12 @@ elseif("${ARCH}" STREQUAL "x86")
else()
set(triple i686-pc-none-elf)
endif()
elseif("${ARCH}" STREQUAL "riscv")
if(CONFIG_64BIT)
set(triple riscv64-unknown-elf)
else()
set(triple riscv32-unknown-elf)
endif()
endif()
if(DEFINED triple)