[U-Boot] [PATCH 05/29] blackfin: Use compiler-generated symbols for BSS

Simon Glass sjg at chromium.org
Thu Dec 15 04:27:36 CET 2016


Adjust the code to work as on ARM, where the compiler generates the BSS
symbols. This makes it easier to move the BSS memset() to C code.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/blackfin/cpu/start.S    |  4 ++--
 arch/blackfin/cpu/u-boot.lds | 18 ++++++++++++++++--
 arch/blackfin/lib/sections.c |  2 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S
index 823a1df..6265a51 100644
--- a/arch/blackfin/cpu/start.S
+++ b/arch/blackfin/cpu/start.S
@@ -196,8 +196,8 @@ ENTRY(_start)
 	 * takes care of clearing things for us.
 	 */
 	serial_early_puts("Zero BSS");
-	r0.l = __bss_start;
-	r0.h = __bss_start;
+	r0.l = ___bss_start;
+	r0.h = ___bss_start;
 	r1 = 0 (x);
 	r2.l = __bss_len;
 	r2.h = __bss_len;
diff --git a/arch/blackfin/cpu/u-boot.lds b/arch/blackfin/cpu/u-boot.lds
index 1c0df25..ba95bf3 100644
--- a/arch/blackfin/cpu/u-boot.lds
+++ b/arch/blackfin/cpu/u-boot.lds
@@ -130,6 +130,16 @@ SECTIONS
 	__end = __data_l1_lma;
 	__image_binary_end = __data_l1_lma;
 
+	/*
+	 * Compiler-generated __bss_start and __bss_stop:
+	 * see arch/blackfin/lib/sections.c
+	*/
+	.bss_start (NOLOAD) :
+	{
+		. = ALIGN(4);
+		KEEP(*(.__bss_start));
+	} >ram_data
+
 	.bss :
 	{
 		. = ALIGN(4);
@@ -139,8 +149,12 @@ SECTIONS
 		*(COMMON)
 		. = ALIGN(4);
 	} >ram_data
-	__bss_end = .;
-	__bss_start = ADDR(.bss);
+
+	.bss_stop (NOLOAD):
+	{
+		KEEP(*(.__bss_stop));
+	} >ram_data
+
 	__bss_len = SIZEOF(.bss);
 	__init_end = .;
 }
diff --git a/arch/blackfin/lib/sections.c b/arch/blackfin/lib/sections.c
index 86fc4df..a67530b 100644
--- a/arch/blackfin/lib/sections.c
+++ b/arch/blackfin/lib/sections.c
@@ -7,5 +7,5 @@
  */
 
 char __bss_start[0] __attribute__((section(".__bss_start")));
-char __bss_end[0] __attribute__((section(".__bss_end")));
+char __bss_stop[0] __attribute__((section(".__bss_stop")));
 char __init_end[0] __attribute__((section(".__init_end")));
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list