From 3a0597f099d5e56c50091816887b72049e9e559a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 15 Mar 2019 14:05:09 +0100 Subject: [PATCH] cmake: LD: Allow input sections to remain unsorted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have users that have problems in their linker scripts where the order of input sections matters. To allow users to use the latest Zephyr while working on a fix to their linker scripts we add an option to allow leaving the sections unsorted. See discussion here for more details https://github.com/zephyrproject-rtos/zephyr/pull/14183 Signed-off-by: Sebastian Bøe --- CMakeLists.txt | 3 ++- Kconfig.zephyr | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fb025d9abc..ba1cc198b96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,7 +396,8 @@ zephyr_ld_options( # Sort the common symbols and each input section by alignment # in descending order to minimize padding between these symbols. -zephyr_ld_options( +zephyr_ld_option_ifdef( + CONFIG_LINKER_SORT_BY_ALIGNMENT ${LINKERFLAGPREFIX},--sort-common=descending ${LINKERFLAGPREFIX},--sort-section=alignment ) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 99502c9d80d..9ada8a517b1 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -186,6 +186,14 @@ config CHECK_LINK_MAP Run a linker address generation validity checker at the end of the build. +config LINKER_SORT_BY_ALIGNMENT + bool "Sort input sections by alignment" + default y + help + This turns on the linker flag to sort sections by alignment + in decreasing size of symbols. This helps to minimize + padding between symbols. + endmenu menu "Compiler Options"