]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
x86: Don't relocate symbols which point to things that aren't relocated
authorGabe Black <gabeblack@chromium.org>
Sat, 12 Nov 2011 16:34:48 +0000 (16:34 +0000)
committerGraeme Russ <graeme.russ@gmail.com>
Tue, 29 Nov 2011 10:30:44 +0000 (21:30 +1100)
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@chromium.org>
arch/x86/lib/bios_setup.c
arch/x86/lib/board.c
arch/x86/lib/realmode.c

index 0dfe4a103187bd54aee9e37dc24bdbefa5af5408..265f7d671ee3dce8efb8f09004b25466dfca0c7d 100644 (file)
@@ -78,11 +78,8 @@ static void setvector(int vector, u16 segment, void *handler)
 
 int bios_setup(void)
 {
-       /*
-        * The BIOS section is not relocated and still in the ROM. The
-        * __bios_start symbol was adjusted, though, so adjust it back.
-        */
-       ulong bios_start = (ulong)&__bios_start - gd->reloc_off;
+       /* The BIOS section is not relocated and still in the ROM. */
+       ulong bios_start = (ulong)&__bios_start;
        ulong bios_size = (ulong)&__bios_size;
 
        static int done;
index 244a02163ce544eb5db246e0af2d217b2f54e43b..18e0edee8756e5ffdbcb86cb0fcd59b6df1998c7 100644 (file)
@@ -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);
 
index bf0d0aaa31e16bf42a5278cdde82fd6c0c8a4f6d..75511b2bdf9893f29483d6d3b70d8817f43c3f47 100644 (file)
 
 int realmode_setup(void)
 {
-       /*
-        * The realmode section is not relocated and still in the ROM. The
-        * __realmode_start symbol was adjusted, though, so adjust it back.
-        */
-       ulong realmode_start = (ulong)&__realmode_start - gd->reloc_off;
+       /* The realmode section is not relocated and still in the ROM. */
+       ulong realmode_start = (ulong)&__realmode_start;
        ulong realmode_size = (ulong)&__realmode_size;
 
        /* copy the realmode switch code */