[PATCH 1/4] handoff-data: put handoff data into data section

Sascha Hauer s.hauer at pengutronix.de
Tue May 21 03:49:10 PDT 2024


The intention was to put the handoff data into the data section and not
into the bss section so that it won't be cleared by another call to
setup_c(). This was not fully done, add a __section(.data) to the
missing places.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/pbl/handoff-data.h | 18 +++++++++---------
 pbl/handoff-data.c         |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/pbl/handoff-data.h b/include/pbl/handoff-data.h
index 7f883421df..18ea9e508b 100644
--- a/include/pbl/handoff-data.h
+++ b/include/pbl/handoff-data.h
@@ -24,15 +24,15 @@ struct handoff_data_entry {
 	unsigned int flags;
 };
 
-#define handoff_data_add_flags(_cookie, _data, _size, _flags)	\
-	do {							\
-		static struct handoff_data_entry hde;		\
-		hde.cookie = _cookie;				\
-		hde.data = _data;				\
-		hde.size = _size;				\
-		hde.flags = _flags;				\
-								\
-		handoff_data_add_entry(&hde);			\
+#define handoff_data_add_flags(_cookie, _data, _size, _flags)		\
+	do {								\
+		static struct handoff_data_entry hde __section(.data);	\
+		hde.cookie = _cookie;					\
+		hde.data = _data;					\
+		hde.size = _size;					\
+		hde.flags = _flags;					\
+									\
+		handoff_data_add_entry(&hde);				\
 	} while (0);
 
 #define handoff_data_add(_cookie, _data, _size)			\
diff --git a/pbl/handoff-data.c b/pbl/handoff-data.c
index e6745797c0..85c3985995 100644
--- a/pbl/handoff-data.c
+++ b/pbl/handoff-data.c
@@ -9,7 +9,7 @@ static struct handoff_data *handoff_data = (void *)-1;
 
 static struct handoff_data *handoff_data_get(void)
 {
-	static struct handoff_data __handoff_data;
+	static struct handoff_data __handoff_data __section(.data);
 
 	/*
 	 * Sometimes the PBL copies itself to some other location and is
-- 
2.39.2




More information about the barebox mailing list