[PATCH 2/2] dm: Fix linker list alignment for ll_entry_get()

Simon Glass sjg at chromium.org
Sat Mar 21 14:46:24 CET 2026


From: Simon Glass <simon.glass at canonical.com>

The extern declaration in ll_entry_get() lacks the __aligned(4)
attribute present in ll_entry_declare(). When the compiler sees an
unaligned extern reference to a linker list entry in the same
compilation unit as its definition, it may increase the section
alignment beyond the expected struct size. This causes gaps in the
linker list array, which the alignment checker reports as failures.

For example, sandbox_dir is both defined and referenced via
DM_DRIVER_GET() in sandboxfs.c. The compiler applies 32-byte
alignment to its section instead of the 4-byte alignment from the
definition, creating an 8-byte gap before it in the driver list.

Add __aligned(4) to the extern declaration in ll_entry_get() to
match ll_entry_declare()

Signed-off-by: Simon Glass <simon.glass at canonical.com>
---

 include/linker_lists.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 6a018f175ca..470dcfc621a 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -284,7 +284,8 @@
  */
 #define ll_entry_get(_type, _name, _list)				\
 	({								\
-		extern _type _u_boot_list_2_##_list##_2_##_name;	\
+		extern _type _u_boot_list_2_##_list##_2_##_name		\
+			__aligned(4);					\
 		_type *_ll_result =					\
 			&_u_boot_list_2_##_list##_2_##_name;		\
 		_ll_result;						\
-- 
2.43.0



More information about the U-Boot mailing list