Skip to content
Permalink
Browse files

cmake: LD: Allow input sections to remain unsorted

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
#14183

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
  • Loading branch information...
SebastianBoe authored and carlescufi committed Mar 15, 2019
1 parent 5895f8d commit 3a0597f099d5e56c50091816887b72049e9e559a
Showing with 10 additions and 1 deletion.
  1. +2 −1 CMakeLists.txt
  2. +8 −0 Kconfig.zephyr
@@ -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
)
@@ -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"

0 comments on commit 3a0597f

Please sign in to comment.
You can’t perform that action at this time.