summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/Kconfig18
-rw-r--r--arch/mips/config.mk2
-rw-r--r--arch/mips/cpu/u-boot.lds20
3 files changed, 32 insertions, 8 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 071dea04ec..6d646ef999 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -248,6 +248,24 @@ config MIPS_CACHE_INDEX_BASE
Normally this is CKSEG0. If the MIPS system needs to move this block
to some SRAM or ScratchPad RAM, adapt this option accordingly.
+config MIPS_RELOCATION_TABLE_SIZE
+ hex "Relocation table size"
+ range 0x100 0x10000
+ default "0x8000"
+ ---help---
+ A table of relocation data will be appended to the U-Boot binary
+ and parsed in relocate_code() to fix up all offsets in the relocated
+ U-Boot.
+
+ This option allows the amount of space reserved for the table to be
+ adjusted in a range from 256 up to 64k. The default is 32k and should
+ be ok in most cases. Reduce this value to shrink the size of U-Boot
+ binary.
+
+ The build will fail and a valid size suggested if this is too small.
+
+ If unsure, leave at the default value.
+
endmenu
menu "OS boot interface"
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 8aa45fc45c..22223a0f3e 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -55,7 +55,7 @@ PLATFORM_ELFFLAGS += -B mips $(OBJCOPYFLAGS)
# MODFLAGS += -mlong-calls
#
ifndef CONFIG_SPL_BUILD
-OBJCOPYFLAGS += -j .got -j .rel -j .padding -j .dtb.init.rodata
+OBJCOPYFLAGS += -j .data.reloc -j .dtb.init.rodata
LDFLAGS_FINAL += --emit-relocs
endif
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds
index f2c9f94f74..fd0f1b5d4f 100644
--- a/arch/mips/cpu/u-boot.lds
+++ b/arch/mips/cpu/u-boot.lds
@@ -41,16 +41,22 @@ SECTIONS
__image_copy_end = .;
__init_end = .;
- /*
- * .rel must come last so that the mips-relocs tool can shrink
- * the section size & the PT_LOAD program header filesz.
- */
- .rel : {
+ .data.reloc : {
__rel_start = .;
- BYTE(0x0)
- . += (32 * 1024) - 1;
+ /*
+ * Space for relocation table
+ * This needs to be filled so that the
+ * mips-reloc tool can overwrite the content.
+ * An invalid value is left at the start of the
+ * section to abort relocation if the table
+ * has not been filled in.
+ */
+ LONG(0xFFFFFFFF);
+ FILL(0);
+ . += CONFIG_MIPS_RELOCATION_TABLE_SIZE - 4;
}
+ . = ALIGN(4);
_end = .;
.bss __rel_start (OVERLAY) : {