Skip to content
Snippets Groups Projects
Commit 769db03a authored by Gabe Black's avatar Gabe Black Committed by Graeme Russ
Browse files

x86: Don't relocate symbols which point to things that aren't relocated


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: default avatarGabe Black <gabeblack@chromium.org>
parent 03228b26
No related branches found
No related tags found
No related merge requests found
...@@ -78,11 +78,8 @@ static void setvector(int vector, u16 segment, void *handler) ...@@ -78,11 +78,8 @@ static void setvector(int vector, u16 segment, void *handler)
int bios_setup(void) int bios_setup(void)
{ {
/* /* The BIOS section is not relocated and still in the ROM. */
* The BIOS section is not relocated and still in the ROM. The ulong bios_start = (ulong)&__bios_start;
* __bios_start symbol was adjusted, though, so adjust it back.
*/
ulong bios_start = (ulong)&__bios_start - gd->reloc_off;
ulong bios_size = (ulong)&__bios_size; ulong bios_size = (ulong)&__bios_size;
static int done; static int done;
......
...@@ -231,9 +231,12 @@ static int do_elf_reloc_fixups(void) ...@@ -231,9 +231,12 @@ static int do_elf_reloc_fixups(void)
offset_ptr_ram = offset_ptr_rom + gd->reloc_off; offset_ptr_ram = offset_ptr_rom + gd->reloc_off;
/* Check that the target points into .text */ /* 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; *offset_ptr_ram += gd->reloc_off;
} }
}
} while (re_src++ < re_end); } while (re_src++ < re_end);
return 0; return 0;
......
...@@ -30,11 +30,8 @@ ...@@ -30,11 +30,8 @@
int realmode_setup(void) int realmode_setup(void)
{ {
/* /* The realmode section is not relocated and still in the ROM. */
* The realmode section is not relocated and still in the ROM. The ulong realmode_start = (ulong)&__realmode_start;
* __realmode_start symbol was adjusted, though, so adjust it back.
*/
ulong realmode_start = (ulong)&__realmode_start - gd->reloc_off;
ulong realmode_size = (ulong)&__realmode_size; ulong realmode_size = (ulong)&__realmode_size;
/* copy the realmode switch code */ /* copy the realmode switch code */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment