[U-Boot] [RFC PATCH v2 19/28] Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Simon Glass sjg at chromium.org
Sat Jan 7 01:24:54 CET 2012


Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

 README           |    6 ++++++
 common/board_f.c |   11 +++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/README b/README
index a9d5a77..7f853d1 100644
--- a/README
+++ b/README
@@ -2754,6 +2754,12 @@ Configuration Settings:
 	its config.mk file). If you find problems enabling this option on
 	your board please report the problem and send patches!
 
+- CONFIG_SYS_SYM_OFFSETS
+	This is set by architectures that use offsets for link symbols
+	instead of absolute values. So bss_start is obtained using an
+	offset _bss_start_ofs from CONFIG_SYS_TEXT_BASE, rather than
+	directly. You should not need to touch this setting.
+
 
 The following definitions that deal with the placement and management
 of environment data (variable area); in general, we support the
diff --git a/common/board_f.c b/common/board_f.c
index 94f316c..2aa2cf1 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -108,8 +108,13 @@ static int display_text_info(void)
 {
 	ulong bss_start, bss_end;
 
+#ifdef CONFIG_SYS_SYM_OFFSETS
 	bss_start = _bss_start_ofs + _TEXT_BASE;
 	bss_end = _bss_end_ofs + _TEXT_BASE;
+#else
+	bss_start = (ulong)&__bss_start;
+	bss_end = (ulong)&__bss_end;
+#endif
 	debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n",
 	      CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
 
@@ -186,7 +191,11 @@ static int zero_global_data(void)
 
 static int setup_mon_len(void)
 {
+#ifdef CONFIG_SYS_SYM_OFFSETS
 	gd->mon_len = _bss_end_ofs;
+#else
+	gd->mon_len = (ulong)&__bss_end - (ulong)&__text_start;
+#endif
 	return 0;
 }
 
@@ -423,6 +432,7 @@ static int jump_to_copy(void)
 
 static init_fnc_t init_sequence_f[] = {
 	setup_global_data_ptr,
+	zero_global_data,
 	setup_fdt,
 	setup_mon_len,
 #if defined(CONFIG_ARCH_CPU_INIT)
@@ -457,6 +467,7 @@ static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_POST
 	init_post,
 #endif
+	setup_dram_config,
 	setup_reloc,
 #if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
 	reserve_logbuffer,
-- 
1.7.3.1



More information about the U-Boot mailing list