zephyr/cmake/linker/ld/target_base.cmake
Mark Ruvald Pedersen d7ee114106 cmake: Toolchain abstraction: move PROPERTY_LINKER_SCRIPT_DEFINES
Move PROPERTY_LINKER_SCRIPT_DEFINES 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>
2019-05-07 22:17:29 -04:00

28 lines
831 B
CMake

# SPDX-License-Identifier: Apache-2.0
# See root CMakeLists.txt for description and expectations of these macros
macro(toolchain_ld_base)
if(NOT PROPERTY_LINKER_SCRIPT_DEFINES)
set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__GCC_LINKER_CMD__)
endif()
# 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
)
# Sort the common symbols and each input section by alignment
# in descending order to minimize padding between these symbols.
zephyr_ld_option_ifdef(
CONFIG_LINKER_SORT_BY_ALIGNMENT
${LINKERFLAGPREFIX},--sort-common=descending
${LINKERFLAGPREFIX},--sort-section=alignment
)
endmacro()