Skip to content

Commit

Permalink
arch: ARM: set -mthumb, -mcpu, -mfpu and -mfloat-abi in linker flags
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
aurel32 authored and nashif committed Dec 5, 2018
1 parent d941df7 commit c6727d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ zephyr_compile_options(
)
endif()

zephyr_ld_options(
${TOOLCHAIN_LD_FLAGS}
)

if(NOT CONFIG_NATIVE_APPLICATION)
zephyr_ld_options(
-nostdlib
Expand Down
7 changes: 7 additions & 0 deletions cmake/compiler/gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c6727d4

Please sign in to comment.