mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-03 17:38:44 +00:00
Fixes #28456 This commit extends `target_ld_options()` with a NO_SPLIT flag. Specifying `NO_SPLIT` will ensure that all linker flags will be applied together when testing the compiler and linker. This allows a caller to ensure that flags are tested together. This fixes the RISC-V case where the flags `-mabi` and `-march` were omitted because they were tested individually. Note, the update of `target_ld_options()` will allow the same flag on `zephyr_ld_options()` Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
35 lines
1.0 KiB
CMake
35 lines
1.0 KiB
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
set(riscv_mabi "lp")
|
|
set(riscv_march "rv")
|
|
|
|
if(CONFIG_64BIT)
|
|
string(CONCAT riscv_mabi ${riscv_mabi} "64")
|
|
string(CONCAT riscv_march ${riscv_march} "64ima")
|
|
list(APPEND TOOLCHAIN_C_FLAGS -mcmodel=medany)
|
|
else()
|
|
string(CONCAT riscv_mabi "i" ${riscv_mabi} "32")
|
|
string(CONCAT riscv_march ${riscv_march} "32ima")
|
|
endif()
|
|
|
|
if(CONFIG_FPU)
|
|
if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)
|
|
if(CONFIG_FLOAT_HARD)
|
|
string(CONCAT riscv_mabi ${riscv_mabi} "d")
|
|
endif()
|
|
string(CONCAT riscv_march ${riscv_march} "fd")
|
|
else()
|
|
if(CONFIG_FLOAT_HARD)
|
|
string(CONCAT riscv_mabi ${riscv_mabi} "f")
|
|
endif()
|
|
string(CONCAT riscv_march ${riscv_march} "f")
|
|
endif()
|
|
endif()
|
|
|
|
if(CONFIG_COMPRESSED_ISA)
|
|
string(CONCAT riscv_march ${riscv_march} "c")
|
|
endif()
|
|
|
|
list(APPEND TOOLCHAIN_C_FLAGS -mabi=${riscv_mabi} -march=${riscv_march})
|
|
list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT -mabi=${riscv_mabi} -march=${riscv_march})
|