arch: ARM: set -mthumb, -mcpu, -mfpu and -mfloat-abi in linker flags
Some toolchains are built with multilib enabled in order to provide multiple versions of the same library, optimized for different ABI or architecture. They require the the ABI/architecture/CPU selection options to be passed at linked time. This is important for example when linking with newlib. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
d941df7ea7
commit
c6727d49b7
2 changed files with 11 additions and 0 deletions
|
@ -162,6 +162,10 @@ zephyr_compile_options(
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
zephyr_ld_options(
|
||||||
|
${TOOLCHAIN_LD_FLAGS}
|
||||||
|
)
|
||||||
|
|
||||||
if(NOT CONFIG_NATIVE_APPLICATION)
|
if(NOT CONFIG_NATIVE_APPLICATION)
|
||||||
zephyr_ld_options(
|
zephyr_ld_options(
|
||||||
-nostdlib
|
-nostdlib
|
||||||
|
|
|
@ -82,15 +82,22 @@ else()
|
||||||
-mthumb
|
-mthumb
|
||||||
-mcpu=${GCC_M_CPU}
|
-mcpu=${GCC_M_CPU}
|
||||||
)
|
)
|
||||||
|
list(APPEND TOOLCHAIN_LD_FLAGS
|
||||||
|
-mthumb
|
||||||
|
-mcpu=${GCC_M_CPU}
|
||||||
|
)
|
||||||
|
|
||||||
include(${ZEPHYR_BASE}/cmake/fpu-for-gcc-m-cpu.cmake)
|
include(${ZEPHYR_BASE}/cmake/fpu-for-gcc-m-cpu.cmake)
|
||||||
|
|
||||||
if(CONFIG_FLOAT)
|
if(CONFIG_FLOAT)
|
||||||
list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
|
list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
|
||||||
|
list(APPEND TOOLCHAIN_LD_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
|
||||||
if (CONFIG_FP_SOFTABI)
|
if (CONFIG_FP_SOFTABI)
|
||||||
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=softfp)
|
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=softfp)
|
||||||
|
list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=softfp)
|
||||||
elseif(CONFIG_FP_HARDABI)
|
elseif(CONFIG_FP_HARDABI)
|
||||||
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=hard)
|
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=hard)
|
||||||
|
list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=hard)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif("${ARCH}" STREQUAL "arc")
|
elseif("${ARCH}" STREQUAL "arc")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue