cmake: Toolchain abstraction: build-id,gc-sections to toolchain_ld_base Move --gc-sections flag to toolchain_ld_base() Move --build-id=none flag to toolchain_ld_base() No functional change expected. This is motivated by the wish to abstract Zephyr's usage of toolchains, permitting non-intrusive porting to other (commercial) toolchains. Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt index 91c369c..cb58f2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -376,11 +376,6 @@ endif() endif() -zephyr_ld_options( - ${LINKERFLAGPREFIX},--gc-sections - ${LINKERFLAGPREFIX},--build-id=none - ) - # Sort the common symbols and each input section by alignment # in descending order to minimize padding between these symbols. zephyr_ld_option_ifdef(
diff --git a/cmake/linker/ld/target_baremetal.cmake b/cmake/linker/ld/target_baremetal.cmake index 96d3374..493a556 100644 --- a/cmake/linker/ld/target_baremetal.cmake +++ b/cmake/linker/ld/target_baremetal.cmake
@@ -4,6 +4,7 @@ macro(toolchain_ld_baremetal) + # LINKERFLAGPREFIX comes from linker/ld/target.cmake zephyr_ld_options( -nostdlib -static
diff --git a/cmake/linker/ld/target_base.cmake b/cmake/linker/ld/target_base.cmake index bc0b29e..5a27146 100644 --- a/cmake/linker/ld/target_base.cmake +++ b/cmake/linker/ld/target_base.cmake
@@ -5,8 +5,11 @@ macro(toolchain_ld_base) # TOOLCHAIN_LD_FLAGS comes from compiler/gcc/target.cmake + # LINKERFLAGPREFIX comes from linker/ld/target.cmake zephyr_ld_options( ${TOOLCHAIN_LD_FLAGS} + ${LINKERFLAGPREFIX},--gc-sections + ${LINKERFLAGPREFIX},--build-id=none ) endmacro()