summaryrefslogtreecommitdiff
path: root/arch/i386/lib
diff options
context:
space:
mode:
authorGraeme Russ <graeme.russ@gmail.com>2011-02-12 04:12:05 (GMT)
committerGraeme Russ <graeme.russ@gmail.com>2011-02-12 04:12:05 (GMT)
commit5fed82110dff2d378e0a50787dcd1a96d83c3c5b (patch)
treec7d293d9cc84b589b358e678135be3cc622471d0 /arch/i386/lib
parent0b2378557c66f97449fe899d51171819599cfc1b (diff)
downloadu-boot-5fed82110dff2d378e0a50787dcd1a96d83c3c5b.tar.xz
x86: Fix incorrect usage of relocation offset
x86 has always used relocation offset in the opposite sense to the ELF standard - Fix this
Diffstat (limited to 'arch/i386/lib')
-rw-r--r--arch/i386/lib/board.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c
index 32f013a..8ec0446 100644
--- a/arch/i386/lib/board.c
+++ b/arch/i386/lib/board.c
@@ -214,7 +214,7 @@ void board_init_f(ulong boot_flags)
addr_sp = dest_addr;
dest_addr -= CONFIG_SYS_STACK_SIZE;
dest_addr -= (bss_end - text_start);
- rel_offset = text_start - dest_addr;
+ rel_offset = dest_addr - text_start;
/* First stage CPU initialization */
if (cpu_init_f() != 0)
@@ -233,8 +233,8 @@ void board_init_f(ulong boot_flags)
*dst_addr++ = *src_addr++;
/* Clear BSS */
- dst_addr = (ulong *)(bss_start - rel_offset);
- end_addr = (ulong *)(bss_end - rel_offset);
+ dst_addr = (ulong *)(bss_start + rel_offset);
+ end_addr = (ulong *)(bss_end + rel_offset);
while (dst_addr < end_addr)
*dst_addr++ = 0x00000000;
@@ -245,8 +245,8 @@ void board_init_f(ulong boot_flags)
do {
if (re_src->r_offset >= CONFIG_SYS_TEXT_BASE)
- if (*(Elf32_Addr *)(re_src->r_offset - rel_offset) >= CONFIG_SYS_TEXT_BASE)
- *(Elf32_Addr *)(re_src->r_offset - rel_offset) -= rel_offset;
+ if (*(Elf32_Addr *)(re_src->r_offset + rel_offset) >= CONFIG_SYS_TEXT_BASE)
+ *(Elf32_Addr *)(re_src->r_offset + rel_offset) += rel_offset;
} while (re_src++ < re_end);
gd->reloc_off = rel_offset;