]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: Remove rel.dyn from SPL linker scripts
authorTom Rini <trini@konsulko.com>
Tue, 27 Jan 2026 21:31:49 +0000 (15:31 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 28 Jan 2026 18:57:01 +0000 (12:57 -0600)
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 <festevam@gmail.com>
Reported-by: Fabio Estevam <festevam@gmail.com>
Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
arch/arm/cpu/u-boot-spl.lds
arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
board/davinci/da8xxevm/u-boot-spl-da850evm.lds

index b4adae272ebaf63759f29c19f00f77754af70777..ac166d1d85264346ec3be8d3827a98d213b71dd6 100644 (file)
@@ -33,14 +33,6 @@ SECTIONS
                *(.data*)
        }
 
-       . = ALIGN(4);
-
-       .rel.dyn : {
-               __rel_dyn_start = .;
-               *(.rel*)
-               __rel_dyn_end = .;
-       }
-
        .bss : {
                . = ALIGN(4);
                __bss_start = .;
index d780a50607748309a6ac1b6cc2189bea2481545d..c578c3ebf821e2189533f1d7d0fda65c5f2cbb6f 100644 (file)
@@ -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);
index c9664a6ce566657671e1a904bcc03611364db372..303ace2f61ca9cf9f3a52c9ab85aa0f6b5f40336 100644 (file)
@@ -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 = .;
 
index d1a82e118af1030123e1b9bac519acc8afee5db8..c369c14a25587f731989b6c5270826c3464b2622 100644 (file)
@@ -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