[PATCH 03/10] m68k: Update linker scripts to ensure appended device tree is aligned

Tom Rini trini at konsulko.com
Thu Jan 15 23:19:33 CET 2026


With commit 0535e46d55d7 ("scripts/dtc: Update to upstream version
v1.7.2-35-g52f07dcca47c") it is now a fatal error to U-Boot if our
device tree is not 8-byte aligned. In commit f613a6e15ef7 ("ARM: OMAP2+:
Pad SPL binary to 8-byte alignment before DTB") Beleswar Padhi explains
that we must have ALIGN(x) statements inside of a section to ensure that
padding is included and not simply that the linker address counter is
incremented. To that end, this patch:
- Remove part of what Marek Vasut did in commit 9ed99e2eeadb ("m68k:
  Assure end of U-Boot is at 8-byte aligned offset") as we now better
  understand what can trigger failure and check for it.
- Rewrite the '.dynsym' section to follow modern practices, and include
  the 8-byte alignment at the end of the section.
- Ensure that we do have alignment by adding an ASSERT so that when not
  aligned we fail to link (and explain why).

Signed-off-by: Tom Rini <trini at konsulko.com>
---
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
Cc: Richard Henderson <richard.henderson at linaro.org>
---
 arch/m68k/cpu/u-boot.lds | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/m68k/cpu/u-boot.lds b/arch/m68k/cpu/u-boot.lds
index be1ad0170af6..452003ff43cb 100644
--- a/arch/m68k/cpu/u-boot.lds
+++ b/arch/m68k/cpu/u-boot.lds
@@ -69,28 +69,27 @@ SECTIONS
 	__ex_table : { *(__ex_table) }
 	__stop___ex_table = .;
 
-	. = ALIGN(8);
+	. = ALIGN(4);
 	__init_begin = .;
 	.text.init : { *(.text.init) }
 	.data.init : { *(.data.init) }
-	. = ALIGN(8);
+	. = ALIGN(4);
 	__init_end = .;
 
-	. = ALIGN(8);
+	. = ALIGN(4);
 	__rel_dyn_start = .;
 	.rela.dyn : {
 		*(.rela.dyn)
 	}
 	__rel_dyn_end = .;
 
-	. = ALIGN(8);
-	__dyn_sym_start = .;
-	.dynsym : {
+	.dynsym ALIGN(4) : {
+		__dyn_sym_start = .;
 		*(.dynsym)
+		__dyn_sym_end = .;
+		. = ALIGN(8);
 	}
-	__dyn_sym_end = .;
 
-	. = ALIGN(8);
 	_end = .;
 
 	__bss_start = .;
@@ -100,9 +99,11 @@ SECTIONS
 		*(.bss*)
 		*(.sbss*)
 		*(COMMON)
-		. = ALIGN(8);
+		. = ALIGN(4);
 		_ebss = .;
 	}
 	__bss_end = . ;
 	PROVIDE (end = .);
 }
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
-- 
2.43.0



More information about the U-Boot mailing list