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:
Aurelien Jarno 2018-11-26 13:48:34 +01:00 committed by Anas Nashif
commit c6727d49b7
2 changed files with 11 additions and 0 deletions

View file

@ -162,6 +162,10 @@ zephyr_compile_options(
)
endif()
zephyr_ld_options(
${TOOLCHAIN_LD_FLAGS}
)
if(NOT CONFIG_NATIVE_APPLICATION)
zephyr_ld_options(
-nostdlib

View file

@ -82,15 +82,22 @@ else()
-mthumb
-mcpu=${GCC_M_CPU}
)
list(APPEND TOOLCHAIN_LD_FLAGS
-mthumb
-mcpu=${GCC_M_CPU}
)
include(${ZEPHYR_BASE}/cmake/fpu-for-gcc-m-cpu.cmake)
if(CONFIG_FLOAT)
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)
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=softfp)
list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=softfp)
elseif(CONFIG_FP_HARDABI)
list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=hard)
list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=hard)
endif()
endif()
elseif("${ARCH}" STREQUAL "arc")