[U-Boot] [PATCH v4] x86: Don't relocate symbols which point to things that aren't relocated
Graeme Russ
graeme.russ at gmail.com
Tue Nov 15 02:51:42 CET 2011
Hi Gabe,
On Sun, Nov 13, 2011 at 1:34 PM, Gabe Black <gabeblack at chromium.org> wrote:
> This change adds an upper bound for symbols which are fixed up after u-boot
> is relocated into RAM. This way portions that are left at their original
> location can be referred to without having to manually fix up any pointers.
>
> Signed-off-by: Gabe Black <gabeblack at chromium.org>
> ---
> Changes in v2:
> Merge in a fix in a later patch which gets rid of some unintentional
> pointer arithmetic.
>
> Changes in v3:
> Update x86 tag.
>
> Changes in v4:
> Rebase onto the x86 repository.
>
> arch/x86/lib/bios_setup.c | 7 ++-----
> arch/x86/lib/board.c | 5 ++++-
> arch/x86/lib/realmode.c | 7 ++-----
> 3 files changed, 8 insertions(+), 11 deletions(-)
>
[snip]
> diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
> index 244a021..18e0ede 100644
> --- a/arch/x86/lib/board.c
> +++ b/arch/x86/lib/board.c
> @@ -231,8 +231,11 @@ static int do_elf_reloc_fixups(void)
> offset_ptr_ram = offset_ptr_rom + gd->reloc_off;
>
> /* Check that the target points into .text */
> - if (*offset_ptr_ram >= CONFIG_SYS_TEXT_BASE)
> + if (*offset_ptr_ram >= CONFIG_SYS_TEXT_BASE &&
> + *offset_ptr_ram <
> + (CONFIG_SYS_TEXT_BASE + size)) {
> *offset_ptr_ram += gd->reloc_off;
> + }
> }
> } while (re_src++ < re_end);
>
You forgot the following:
+ /* The size of the region of u-boot that runs out of RAM. */
+ uintptr_t size = (uintptr_t)&__bss_end -
+ (uintptr_t)&__text_start;
+
And I didn't check before committing, and now it's in u-boot-x86/master :(
Can you please send a fix
I'll add a fix for my fubar as a fresh commit as well
Regards,
Graeme
More information about the U-Boot
mailing list