From 5ffc1dcc26d3df9e2b192151936cb98014fb6e49 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 27 Jan 2026 15:31:49 -0600 Subject: [PATCH] arm: Remove rel.dyn from SPL linker scripts As of v2026.01, no platforms contain any rel.dyn sections in their xPL phase images. Their inclusion in linker scripts initially was an oversight as part of taking the full U-Boot linker scripts and modifying them down. Then in commit 8b0ebe054bb3 ("arm: Update linker scripts to ensure appended device tree is aligned") these sections were used to force correct alignment for the device tree. This however, lead to a different problem. That problem is that when we do not have a separate BSS section in SPL we instead would overlay the BSS with the rel.dyn section, in the common linker script case. This in turn lead to creating an incorrectly sized BSS "pad" file sometimes (depending on arbitrary changes within the rest of the binary itself). This in turn lead to the dtb being in the wrong location in the binary and not found at run time. This commit fixes a few things: - Remove the rel.dyn section from all ARM SPL linker scripts. - In turn, this moves the dtb alignment statement in to another section. - For ast2600 which uses CONFIG_POSITION_INDEPENDENT we need to keep the symbols however. Tested-by: Fabio Estevam Reported-by: Fabio Estevam Co-developed-by: Ilias Apalodimas Reviewed-by: Chia-Wei, Wang Signed-off-by: Tom Rini --- arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds | 8 -------- arch/arm/cpu/u-boot-spl.lds | 13 ++----------- arch/arm/mach-aspeed/ast2600/u-boot-spl.lds | 16 +++++++--------- board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 9 ++------- 4 files changed, 11 insertions(+), 35 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds index b4adae272eb..ac166d1d852 100644 --- a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds +++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds @@ -33,14 +33,6 @@ SECTIONS *(.data*) } - . = ALIGN(4); - - .rel.dyn : { - __rel_dyn_start = .; - *(.rel*) - __rel_dyn_end = .; - } - .bss : { . = ALIGN(4); __bss_start = .; diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds index d780a506077..c578c3ebf82 100644 --- a/arch/arm/cpu/u-boot-spl.lds +++ b/arch/arm/cpu/u-boot-spl.lds @@ -41,23 +41,14 @@ SECTIONS __binman_sym_start = .; KEEP(*(SORT(.binman_sym*))); __binman_sym_end = .; - } - - . = ALIGN(4); - - __image_copy_end = .; - - .rel.dyn : { - __rel_dyn_start = .; - *(.rel*) - __rel_dyn_end = .; . = ALIGN(8); } + __image_copy_end = .; _image_binary_end = .; _end = .; - .bss __rel_dyn_start (OVERLAY) : { + .bss : { __bss_start = .; *(.bss*) . = ALIGN(8); diff --git a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds index c9664a6ce56..303ace2f61c 100644 --- a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds +++ b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds @@ -49,19 +49,17 @@ SECTIONS __binman_sym_start = .; KEEP(*(SORT(.binman_sym*))); __binman_sym_end = .; + . = ALIGN(8); } > .nor - . = ALIGN(4); + /* + * These platforms enable CONFIG_POSITION_INDEPENDENT and so need + * these names. The always however hold the same value. + */ + __rel_dyn_start = .; + __rel_dyn_end = .; __image_copy_end = .; - - .rel.dyn : { - __rel_dyn_start = .; - *(.rel*) - __rel_dyn_end = .; - . = ALIGN(8); - } > .nor - _end = .; _image_binary_end = .; diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds index d1a82e118af..c369c14a255 100644 --- a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds +++ b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds @@ -36,13 +36,8 @@ SECTIONS .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram . = ALIGN(4); - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))); } >.sram - - . = ALIGN(4); - .rel.dyn : { - __rel_dyn_start = .; - *(.rel*) - __rel_dyn_end = .; + __u_boot_list : { + KEEP(*(SORT(__u_boot_list*))); . = ALIGN(8); } >.sram -- 2.47.3