Align U-Boot image end to 8 bytes to make sure DT alignment requirement
is fulfilled. This fixes a possible failure in fdt_find_separate() in
case the U-Boot image is aligned to 4 Bytes and DT is appended at the
end at already 8 Byte aligned offset.

Link: https://source.denx.de/u-boot/u-boot/-/issues/30
Reviewed-by: Simon Glass <s...@chromium.org>
Reviewed-by: Tom Rini <tr...@konsulko.com>
Signed-off-by: Marek Vasut <marek.va...@mailbox.org>
---
Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org>
Cc: Sam Edwards <cfswo...@gmail.com>
Cc: Tom Rini <tr...@konsulko.com>
Cc: u-boot@lists.denx.de
---
V2: - Fix up u-boot.lds description of the alignment requirement
    - Fix up SPL alignment as well
    - Add RB from Simon and Tom
---
 arch/arm/cpu/u-boot-spl.lds | 3 ++-
 arch/arm/cpu/u-boot.lds     | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
index eee463a1b1c..5aecb61ce90 100644
--- a/arch/arm/cpu/u-boot-spl.lds
+++ b/arch/arm/cpu/u-boot-spl.lds
@@ -53,13 +53,14 @@ SECTIONS
                __rel_dyn_end = .;
        }
 
+       . = ALIGN(8);
        _image_binary_end = .;
        _end = .;
 
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss*)
-                . = ALIGN(4);
+                . = ALIGN(8);
                __bss_end = .;
        }
        __bss_size = __bss_end - __bss_start;
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 817e7a983ae..78aad093d3b 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -153,14 +153,14 @@ SECTIONS
                __efi_runtime_rel_stop = .;
        }
 
-       . = ALIGN(4);
+       . = ALIGN(8);
        __image_copy_end = .;
 
        /*
         * if CONFIG_USE_ARCH_MEMSET is not selected __bss_end - __bss_start
-        * needs to be a multiple of 4 and we overlay .bss with .rel.dyn
+        * needs to be a multiple of 8 and we overlay .bss with .rel.dyn
         */
-       .rel.dyn ALIGN(4) : {
+       .rel.dyn ALIGN(8) : {
                __rel_dyn_start = .;
                *(.rel*)
                __rel_dyn_end = .;
-- 
2.47.2

Reply via email to