Skip to content

Commit af10d16

Browse files
dcpleunggalak
authored andcommitted
linker: sort sections by alignment
This turns on the linker flag to sort sections by alignment in decreasing size of symbols. This helps to minimize padding between symbols. This also adds the linker options to sort common symbols by alignment in descending to minimize the need for padding. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent 8328d6d commit af10d16

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ zephyr_ld_options(
384384
${LINKERFLAGPREFIX},--build-id=none
385385
)
386386

387+
# Sort the common symbols and each input section by alignment
388+
# in descending order to minimize padding between these symbols.
389+
zephyr_ld_options(
390+
${LINKERFLAGPREFIX},--sort-common=descending
391+
${LINKERFLAGPREFIX},--sort-section=alignment
392+
)
393+
387394
get_property(TOPT GLOBAL PROPERTY TOPT)
388395
set_ifndef( TOPT -T)
389396

0 commit comments

Comments
 (0)