[RFC PATCH u-boot 03/12] linker_lists: declare entries and lists externally visible

Marek Behún marek.behun at nic.cz
Wed Mar 3 05:12:02 CET 2021


Use the `__visible` macro to declare entires and lists declared by
ll_entry_declare() and ll_entry_declare_list() externally visible, so
that when building with LTO the compiler does not optimize this data
away.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
---
 include/linker_lists.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index fd98ecd297..9d44dab2e5 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -70,7 +70,8 @@
 #define ll_entry_declare(_type, _name, _list)				\
 	_type _u_boot_list_2_##_list##_2_##_name __aligned(4)		\
 			__attribute__((unused,				\
-			section(".u_boot_list_2_"#_list"_2_"#_name)))
+			section(".u_boot_list_2_"#_list"_2_"#_name)))	\
+			__visible
 
 /**
  * ll_entry_declare_list() - Declare a list of link-generated array entries
@@ -93,7 +94,8 @@
 #define ll_entry_declare_list(_type, _name, _list)			\
 	_type _u_boot_list_2_##_list##_2_##_name[] __aligned(4)		\
 			__attribute__((unused,				\
-			section(".u_boot_list_2_"#_list"_2_"#_name)))
+			section(".u_boot_list_2_"#_list"_2_"#_name)))	\
+			__visible
 
 /*
  * We need a 0-byte-size type for iterator symbols, and the compiler
-- 
2.26.2



More information about the U-Boot mailing list