]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: spl: Correct alignment of .rel.dyn section
authorTom Rini <trini@konsulko.com>
Mon, 26 Jan 2026 16:28:32 +0000 (10:28 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 26 Jan 2026 16:46:23 +0000 (10:46 -0600)
With commit 0535e46d55d7 ("scripts/dtc: Update to upstream version
v1.7.2-35-g52f07dcca47c") we now require the correct, 8 byte alignment
of a device tree in order to work with it ourselves. This has exposed a
number of issues. In the case of using arch/arm/cpu/u-boot-spl.lds for
an xPL phase and having the BSS be overlayed with the dynamic
relocations sections (here, .rel.dyn) we had missed adding the comment
about our asm memset requirements. Then, when adjusting ALIGN statements
we later missed this one. In turn, when we use objcopy to create our
binary image we end up in the situation where

where the BSS must start out 8 byte aligned as
well as end 8 byte aligned because for appended device tree the
requirement is that the whole BSS (which we add as padding to the
binary) must be 8 byte aligned. Otherwise we end up with the situation
where __bss_end (where we look for the device tree at run time) is
aligned but the size of the BSS we add

Fixes: 7828a1eeb2a1 ("arm: remove redundant section alignments")
Fixes: 52caad0d14a3 ("ARM: Align image end to 8 bytes to fit DT alignment")
Reported-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut@mailbox.org>
arch/arm/cpu/u-boot-spl.lds

index d780a50607748309a6ac1b6cc2189bea2481545d..b4e55e2bdc8dbde75b1337e3924a7f5f3ba9cb23 100644 (file)
@@ -47,7 +47,11 @@ SECTIONS
 
        __image_copy_end = .;
 
-       .rel.dyn : {
+       /*
+        * if CONFIG_SPL_USE_ARCH_MEMSET is not selected __bss_end - __bss_start
+        * needs to be a multiple of 8 and we overlay .bss with .rel.dyn
+        */
+       .rel.dyn ALIGN(8) : {
                __rel_dyn_start = .;
                *(.rel*)
                __rel_dyn_end = .;