]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
xtensa: Assure end of U-Boot is at 8-byte aligned offset
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Sun, 16 Nov 2025 00:14:32 +0000 (01:14 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 28 Nov 2025 16:20:31 +0000 (10:20 -0600)
Make sure the end of U-Boot is at 8-byte aligned offset, not 4-byte
aligned offset. This allows safely appending DT at the end of U-Boot
with the guarantee that the DT will be at 8-byte aligned offset. This
8-byte alignment is now checked by newer libfdt 1.7.2 .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
arch/xtensa/cpu/u-boot.lds
arch/xtensa/include/asm/ldscript.h

index 72e4b9a706e59623aa2fc171ed40282b068ac2e9..6894d4c327bbb8f19a09e52e95cb61559392faac 100644 (file)
@@ -78,7 +78,7 @@ SECTIONS
   SECTION_text(XTENSA_SYS_TEXT_ADDR, FOLLOWING(.DoubleExceptionVector.text))
   SECTION_rodata(ALIGN(16), FOLLOWING(.text))
   SECTION_u_boot_list(ALIGN(16), FOLLOWING(.rodata))
-  SECTION_data(ALIGN(16), FOLLOWING(__u_boot_list))
+  SECTION_data(ALIGN(16), FOLLOWINGDT(__u_boot_list))
 
   __reloc_end = .;
   __init_end = .;
index bcf0fd5a7443b8b73c16e1310ea3d1f5bc21e81e..50d3b39040536336c0d5f85e1f533ee48c4a2bee 100644 (file)
@@ -21,6 +21,9 @@
 #define FORCE_OUTPUT   . = .
 #define FOLLOWING(sec)                                                 \
        AT(((LOADADDR(sec) + SIZEOF(sec) + ALIGN_LMA-1)) & ~(ALIGN_LMA-1))
+#define ALIGN_LMA_DT   8
+#define FOLLOWINGDT(sec)                                               \
+       AT(((LOADADDR(sec) + SIZEOF(sec) + ALIGN_LMA_DT-1)) & ~(ALIGN_LMA_DT-1))
 
 /*
  * Specify an output section that will be added to the ROM store table
                ___u_boot_list_start = ABSOLUTE(.);                     \
                KEEP(*(SORT(__u_boot_list*)));                          \
                ___u_boot_list_end = ABSOLUTE(.);                       \
+               . = ALIGN(ALIGN_LMA_DT);                                \
        }
 
 #define SECTION_data(_vma_, _lma_)                                     \
                *(.eh_frame)                                            \
                *(.dynamic)                                             \
                *(.gnu.version_d)                                       \
+               . = ALIGN(ALIGN_LMA_DT);                                \
                _data_end = ABSOLUTE(.);                                \
        }