Skip to contentSkip to conversation

Blackfin: fix linker scripts to work with --gc-sections

PATCH New Mike Frysinger 1 participant 3 messages Nov 4, 2008 – Dec 30, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Blackfin: fix linker scripts to work with --gc-sections

Make sure all .text sections get pulled in and the entry point is properly referenced so they don't get discarded when linking with --gc-sections.

---
 board/bf533-ezkit/u-boot.lds.S |   23 +++++++++++++----------
 board/bf533-stamp/u-boot.lds.S |   19 +++++++++++--------
 board/bf537-stamp/u-boot.lds.S |   19 +++++++++++--------
 board/bf561-ezkit/u-boot.lds.S |   23 +++++++++++++----------
 4 files changed, 48 insertions(+), 36 deletions(-)
board/bf533-ezkit/u-boot.lds.S +13 -10
index 70764ac..da16726 100644
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <asm/blackfin.h>
 #undef ALIGN
+#undef ENTRY
+#undef bfin
 
 /* If we don't actually load anything into L1 data, this will avoid
  * a syntax error.  If we do actually load something into L1 data,
@@ -50,11 +52,12 @@ MEMORY
 	l1_data : ORIGIN = L1_DATA_B_SRAM,   LENGTH = L1_DATA_B_SRAM_SIZE
 }
 
+ENTRY(_start)
 SECTIONS
 {
 	.text :
 	{
-		cpu/blackfin/start.o (.text)
+		cpu/blackfin/start.o (.text .text.*)
 
 #ifdef ENV_IS_EMBEDDED
 		/* WARNING - the following is hand-optimized to fit within
@@ -63,20 +66,20 @@ SECTIONS
 		 * it linked after the configuration sector.
 		 */
 
-		cpu/blackfin/traps.o		(.text)
-		cpu/blackfin/interrupt.o	(.text)
-		cpu/blackfin/serial.o		(.text)
-		common/dlmalloc.o		(.text)
-		lib_generic/crc32.o		(.text)
-		lib_generic/zlib.o		(.text)
-		board/bf533-ezkit/bf533-ezkit.o		(.text)
+		cpu/blackfin/traps.o		(.text .text.*)
+		cpu/blackfin/interrupt.o	(.text .text.*)
+		cpu/blackfin/serial.o		(.text .text.*)
+		common/dlmalloc.o		(.text .text.*)
+		lib_generic/crc32.o		(.text .text.*)
+		lib_generic/zlib.o		(.text .text.*)
+		board/bf533-ezkit/bf533-ezkit.o		(.text .text.*)
 
 		. = DEFINED(env_offset) ? env_offset : .;
-		common/env_embedded.o	(.text)
+		common/env_embedded.o	(.text .text.*)
 #endif
 
 		__initcode_start = .;
-		cpu/blackfin/initcode.o (.text)
+		cpu/blackfin/initcode.o (.text .text.*)
 		__initcode_end = .;
 
 		*(.text .text.*)
board/bf533-stamp/u-boot.lds.S +11 -8
index 187309f..76daa75 100644
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <asm/blackfin.h>
 #undef ALIGN
+#undef ENTRY
+#undef bfin
 
 /* If we don't actually load anything into L1 data, this will avoid
  * a syntax error.  If we do actually load something into L1 data,
@@ -50,11 +52,12 @@ MEMORY
 	l1_data : ORIGIN = L1_DATA_B_SRAM,   LENGTH = L1_DATA_B_SRAM_SIZE
 }
 
+ENTRY(_start)
 SECTIONS
 {
 	.text :
 	{
-		cpu/blackfin/start.o (.text)
+		cpu/blackfin/start.o (.text .text.*)
 
 #ifdef ENV_IS_EMBEDDED
 		/* WARNING - the following is hand-optimized to fit within
@@ -63,18 +66,18 @@ SECTIONS
 		 * it linked after the configuration sector.
 		 */
 
-		cpu/blackfin/traps.o		(.text)
-		cpu/blackfin/interrupt.o	(.text)
-		cpu/blackfin/serial.o		(.text)
-		common/dlmalloc.o		(.text)
-		lib_generic/crc32.o		(.text)
+		cpu/blackfin/traps.o		(.text .text.*)
+		cpu/blackfin/interrupt.o	(.text .text.*)
+		cpu/blackfin/serial.o		(.text .text.*)
+		common/dlmalloc.o		(.text .text.*)
+		lib_generic/crc32.o		(.text .text.*)
 
 		. = DEFINED(env_offset) ? env_offset : .;
-		common/env_embedded.o	(.text)
+		common/env_embedded.o	(.text .text.*)
 #endif
 
 		__initcode_start = .;
-		cpu/blackfin/initcode.o (.text)
+		cpu/blackfin/initcode.o (.text .text.*)
 		__initcode_end = .;
 
 		*(.text .text.*)
board/bf537-stamp/u-boot.lds.S +11 -8
index 187309f..76daa75 100644
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <asm/blackfin.h>
 #undef ALIGN
+#undef ENTRY
+#undef bfin
 
 /* If we don't actually load anything into L1 data, this will avoid
  * a syntax error.  If we do actually load something into L1 data,
@@ -50,11 +52,12 @@ MEMORY
 	l1_data : ORIGIN = L1_DATA_B_SRAM,   LENGTH = L1_DATA_B_SRAM_SIZE
 }
 
+ENTRY(_start)
 SECTIONS
 {
 	.text :
 	{
-		cpu/blackfin/start.o (.text)
+		cpu/blackfin/start.o (.text .text.*)
 
 #ifdef ENV_IS_EMBEDDED
 		/* WARNING - the following is hand-optimized to fit within
@@ -63,18 +66,18 @@ SECTIONS
 		 * it linked after the configuration sector.
 		 */
 
-		cpu/blackfin/traps.o		(.text)
-		cpu/blackfin/interrupt.o	(.text)
-		cpu/blackfin/serial.o		(.text)
-		common/dlmalloc.o		(.text)
-		lib_generic/crc32.o		(.text)
+		cpu/blackfin/traps.o		(.text .text.*)
+		cpu/blackfin/interrupt.o	(.text .text.*)
+		cpu/blackfin/serial.o		(.text .text.*)
+		common/dlmalloc.o		(.text .text.*)
+		lib_generic/crc32.o		(.text .text.*)
 
 		. = DEFINED(env_offset) ? env_offset : .;
-		common/env_embedded.o	(.text)
+		common/env_embedded.o	(.text .text.*)
 #endif
 
 		__initcode_start = .;
-		cpu/blackfin/initcode.o (.text)
+		cpu/blackfin/initcode.o (.text .text.*)
 		__initcode_end = .;
 
 		*(.text .text.*)
board/bf561-ezkit/u-boot.lds.S +13 -10
index 99d6be6..3d0453e 100644
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <asm/blackfin.h>
 #undef ALIGN
+#undef ENTRY
+#undef bfin
 
 /* If we don't actually load anything into L1 data, this will avoid
  * a syntax error.  If we do actually load something into L1 data,
@@ -50,11 +52,12 @@ MEMORY
 	l1_data : ORIGIN = L1_DATA_B_SRAM,   LENGTH = L1_DATA_B_SRAM_SIZE
 }
 
+ENTRY(_start)
 SECTIONS
 {
 	.text :
 	{
-		cpu/blackfin/start.o (.text)
+		cpu/blackfin/start.o (.text .text.*)
 
 #ifdef ENV_IS_EMBEDDED
 		/* WARNING - the following is hand-optimized to fit within
@@ -63,20 +66,20 @@ SECTIONS
 		 * it linked after the configuration sector.
 		 */
 
-		cpu/blackfin/traps.o		(.text)
-		cpu/blackfin/interrupt.o	(.text)
-		cpu/blackfin/serial.o		(.text)
-		common/dlmalloc.o		(.text)
-		lib_generic/crc32.o		(.text)
-		lib_generic/zlib.o		(.text)
-		board/bf561-ezkit/bf561-ezkit.o		(.text)
+		cpu/blackfin/traps.o		(.text .text.*)
+		cpu/blackfin/interrupt.o	(.text .text.*)
+		cpu/blackfin/serial.o		(.text .text.*)
+		common/dlmalloc.o		(.text .text.*)
+		lib_generic/crc32.o		(.text .text.*)
+		lib_generic/zlib.o		(.text .text.*)
+		board/bf561-ezkit/bf561-ezkit.o		(.text .text.*)
 
 		. = DEFINED(env_offset) ? env_offset : .;
-		common/env_embedded.o	(.text)
+		common/env_embedded.o	(.text .text.*)
 #endif
 
 		__initcode_start = .;
-		cpu/blackfin/initcode.o (.text)
+		cpu/blackfin/initcode.o (.text .text.*)
 		__initcode_end = .;
 
 		*(.text .text.*)
Signature · 1 line
1.6.0.3
#1 lore raw

PATCH 1/1 Blackfin: use common strmhz() in system output

---
 common/cmd_bdinfo.c  |   10 ++++++----
 lib_blackfin/board.c |    6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)
common/cmd_bdinfo.c +6 -4
index 6675241..b660d2a 100644
@@ -328,18 +328,20 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 }
 
 #elif defined(CONFIG_BLACKFIN)
+static void print_str(const char *, const char *);
 
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	int i;
 	bd_t *bd = gd->bd;
+	char buf[32];
 
 	printf("U-Boot      = %s\n", bd->bi_r_version);
 	printf("CPU         = %s\n", bd->bi_cpu);
 	printf("Board       = %s\n", bd->bi_board_name);
-	printf("VCO         = %lu MHz\n", bd->bi_vco / 1000000);
-	printf("CCLK        = %lu MHz\n", bd->bi_cclk / 1000000);
-	printf("SCLK        = %lu MHz\n", bd->bi_sclk / 1000000);
+	print_str("VCO",         strmhz(buf, bd->bi_vco));
+	print_str("CCLK",        strmhz(buf, bd->bi_cclk));
+	print_str("SCLK",        strmhz(buf, bd->bi_sclk));
 
 	print_num("boot_params", (ulong)bd->bi_boot_params);
 	print_num("memstart",    (ulong)bd->bi_memstart);
@@ -430,7 +432,7 @@ static void print_lnum(const char *name, u64 value)
 }
 #endif
 
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_BLACKFIN)
 static void print_str(const char *name, const char *str)
 {
 	printf ("%-12s= %6s MHz\n", name, str);
lib_blackfin/board.c +4 -2
index e184fd2..969359f 100644
@@ -256,6 +256,7 @@ void board_init_f(ulong bootflag)
 {
 	ulong addr;
 	bd_t *bd;
+	char buf[32];
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 	serial_early_puts("Board early init flash\n");
@@ -314,8 +315,9 @@ void board_init_f(ulong bootflag)
 	checkboard();
 	timer_init();
 
-	printf("Clock: VCO: %lu MHz, Core: %lu MHz, System: %lu MHz\n",
-	       get_vco() / 1000000, get_cclk() / 1000000, get_sclk() / 1000000);
+	printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
+	printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
+	printf("System: %s MHz\n", strmhz(buf, get_sclk()));
 
 	printf("RAM:   ");
 	print_size(initdram(0), "\n");
Signature · 1 line
1.6.0.3
#2 lore raw

PATCH 1/1 Blackfin: fix linker scripts to work with --gc-sections

In reply to Mike Frysinger
Quoted 2 lines · On Tuesday 04 November 2008 16:13:43 Mike Frysinger wrote:

Make sure all .text sections get pulled in and the entry point is properly referenced so they don't get discarded when linking with --gc-sections.

ping ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081230/d6948fb8/attachment.pgp