[PATCH u-boot 10/39] linker_lists: declare lists and entries as __ADDRESSABLE for LTO

Marek Behún marek.behun at nic.cz
Sun Mar 7 05:25:09 CET 2021


Use the __ADDRESSABLE() macro to make entries and lists declared by
ll_entry_declare() and ll_entry_declare_list() addressable 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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 815a90691a..c9c3b3c2ad 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -88,7 +88,9 @@
  *           .y = 4,
  *   };
  */
-#define ll_entry_declare(_type, _name, _list) \
+#define ll_entry_declare(_type, _name, _list)	\
+	__lldecl(_type, _name, _list);		\
+	__ADDRESSABLE(__llname(_name, _list));	\
 	__lldecl(_type, _name, _list)
 
 /**
@@ -109,7 +111,9 @@
  *        { .x = 1, .y = 7 }
  *   };
  */
-#define ll_entry_declare_list(_type, _name, _list) \
+#define ll_entry_declare_list(_type, _name, _list)	\
+	__lldecl(_type, _name, _list)[];		\
+	__ADDRESSABLE(__llname(_name, _list));		\
 	__lldecl(_type, _name, _list)[]
 
 /*
-- 
2.26.2



More information about the U-Boot mailing list