Browse Source

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass 8 năm trước cách đây
mục cha
commit
6bda55a38c
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      common/board_f.c

+ 1 - 1
common/board_f.c

@@ -1033,8 +1033,8 @@ static const init_fnc_t init_sequence_f[] = {
 	setup_reloc,
 	setup_reloc,
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
 	copy_uboot_to_ram,
 	copy_uboot_to_ram,
-	clear_bss,
 	do_elf_reloc_fixups,
 	do_elf_reloc_fixups,
+	clear_bss,
 #endif
 #endif
 #if defined(CONFIG_XTENSA)
 #if defined(CONFIG_XTENSA)
 	clear_bss,
 	clear_bss,