Commit 632efa744013205c5f9a2a5fe21bfd0f968d00c7

Authored by Simon Glass
Committed by Tom Rini
1 parent 959daa21d4

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

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@chromium.org>

Showing 2 changed files with 21 additions and 0 deletions Side-by-side Diff

... ... @@ -3222,6 +3222,13 @@
3222 3222 its config.mk file). If you find problems enabling this option on
3223 3223 your board please report the problem and send patches!
3224 3224  
  3225 +- CONFIG_SYS_SYM_OFFSETS
  3226 + This is set by architectures that use offsets for link symbols
  3227 + instead of absolute values. So bss_start is obtained using an
  3228 + offset _bss_start_ofs from CONFIG_SYS_TEXT_BASE, rather than
  3229 + directly. You should not need to touch this setting.
  3230 +
  3231 +
3225 3232 The following definitions that deal with the placement and management
3226 3233 of environment data (variable area); in general, we support the
3227 3234 following configurations:
... ... @@ -107,8 +107,13 @@
107 107 {
108 108 ulong bss_start, bss_end;
109 109  
  110 +#ifdef CONFIG_SYS_SYM_OFFSETS
110 111 bss_start = _bss_start_ofs + _TEXT_BASE;
111 112 bss_end = _bss_end_ofs + _TEXT_BASE;
  113 +#else
  114 + bss_start = (ulong)&__bss_start;
  115 + bss_end = (ulong)&__bss_end;
  116 +#endif
112 117 debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",
113 118 CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
114 119  
115 120  
... ... @@ -174,7 +179,11 @@
174 179  
175 180 static int setup_mon_len(void)
176 181 {
  182 +#ifdef CONFIG_SYS_SYM_OFFSETS
177 183 gd->mon_len = _bss_end_ofs;
  184 +#else
  185 + gd->mon_len = (ulong)&__bss_end - (ulong)&__text_start;
  186 +#endif
178 187 return 0;
179 188 }
180 189  
181 190  
... ... @@ -190,7 +199,11 @@
190 199 gd->fdt_blob = _binary_dt_dtb_start;
191 200 #elif defined CONFIG_OF_SEPARATE
192 201 /* FDT is at end of image */
  202 +# ifdef CONFIG_SYS_SYM_OFFSETS
193 203 gd->fdt_blob = (void *)(_end_ofs + CONFIG_SYS_TEXT_BASE);
  204 +# else
  205 + gd->fdt_blob = (ulong *)&_end;
  206 +# endif
194 207 #endif
195 208 /* Allow the early environment to override the fdt address */
196 209 gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
... ... @@ -483,6 +496,7 @@
483 496 }
484 497  
485 498 static init_fnc_t init_sequence_f[] = {
  499 + zero_global_data,
486 500 setup_fdt,
487 501 setup_mon_len,
488 502 arch_cpu_init, /* basic arch cpu dependent setup */