[PATCH] xtensa: Assure end of U-Boot is at 8-byte aligned offset

Marek Vasut marek.vasut+renesas at mailbox.org
Sun Nov 16 01:14:32 CET 2025


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 at mailbox.org>
---
Cc: Max Filippov <jcmvbkbc at gmail.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 arch/xtensa/cpu/u-boot.lds         | 2 +-
 arch/xtensa/include/asm/ldscript.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/xtensa/cpu/u-boot.lds b/arch/xtensa/cpu/u-boot.lds
index 72e4b9a706e..6894d4c327b 100644
--- a/arch/xtensa/cpu/u-boot.lds
+++ b/arch/xtensa/cpu/u-boot.lds
@@ -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 = .;
diff --git a/arch/xtensa/include/asm/ldscript.h b/arch/xtensa/include/asm/ldscript.h
index bcf0fd5a744..50d3b390405 100644
--- a/arch/xtensa/include/asm/ldscript.h
+++ b/arch/xtensa/include/asm/ldscript.h
@@ -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
@@ -110,6 +113,7 @@
 		___u_boot_list_start = ABSOLUTE(.);			\
 		KEEP(*(SORT(__u_boot_list*)));				\
 		___u_boot_list_end = ABSOLUTE(.);			\
+		. = ALIGN(ALIGN_LMA_DT);				\
 	}
 
 #define SECTION_data(_vma_, _lma_)					\
@@ -130,6 +134,7 @@
 		*(.eh_frame)						\
 		*(.dynamic)						\
 		*(.gnu.version_d)					\
+		. = ALIGN(ALIGN_LMA_DT);				\
 		_data_end = ABSOLUTE(.);				\
 	}
 
-- 
2.51.0



More information about the U-Boot mailing list