[U-Boot] [PATCH v2 1/2] arm920t/at91/reset.c: fix weak reset_board()

Andreas Bießmann andreas.devel at googlemail.com
Thu Nov 4 00:21:22 CET 2010


The arm920t compiler/linker dif not handle weak functions correctely.
Therefore the linker tried to link outside the ELF (isn't that lazy
linking?). This leads to segfault of linker in the end.

This patch adds a empty stub for weak function reset_board() to catch
that case.

Signed-off-by: Andreas Bießmann <andreas.devel at googlemail.com>
---
introduced in v2

 arch/arm/cpu/arm920t/at91/reset.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/arm920t/at91/reset.c b/arch/arm/cpu/arm920t/at91/reset.c
index ce9c156..8c81030 100644
--- a/arch/arm/cpu/arm920t/at91/reset.c
+++ b/arch/arm/cpu/arm920t/at91/reset.c
@@ -35,7 +35,14 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_st.h>
 
-void board_reset(void) __attribute__((__weak__));
+void __attribute__((weak)) board_reset(void)
+{
+	/*
+	 * do absolute nothing here
+	 * but to have a empty stub for weak function to satisfy the linker
+	 */
+}
 
 void reset_cpu(ulong ignored)
 {
@@ -45,8 +52,7 @@ void reset_cpu(ulong ignored)
 	serial_exit();
 #endif
 
-	if (board_reset)
-		board_reset();
+	board_reset();
 
 	/* Reset the cpu by setting up the watchdog timer */
 	writel(AT91_ST_WDMR_RSTEN | AT91_ST_WDMR_EXTEN | AT91_ST_WDMR_WDV(2),
-- 
1.7.3.2



More information about the U-Boot mailing list