summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2013-10-11 17:46:59 +0200
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2014-04-20 13:16:42 +0200
commit79fd7e649e287228a1445820a72f7dd33baedb96 (patch)
tree1b7ef3ccca332f88438c2b3bb52d8b4962951909
parentb149c4c399b111cec1ff7505ca9fabbeeb4fe394 (diff)
downloadtalos-obmc-uboot-79fd7e649e287228a1445820a72f7dd33baedb96.tar.gz
talos-obmc-uboot-79fd7e649e287228a1445820a72f7dd33baedb96.zip
MIPS: always keep all sections in u-boot ELF binary.
Always keep all sections in u-boot ELF binary. Move all unneeded sections after _end to avoid allocating space in the final binary. Also remove .deadcode section which is now obsolete. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
-rw-r--r--arch/mips/config.mk3
-rw-r--r--arch/mips/cpu/u-boot.lds56
2 files changed, 32 insertions, 27 deletions
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 1899f51872..42a806252b 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -52,4 +52,5 @@ PLATFORM_CPPFLAGS += -msoft-float
PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib $(ENDIANNESS)
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections -pie
-OBJCOPYFLAGS += --remove-section=.dynsym
+OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .got
+OBJCOPYFLAGS += -j .u_boot_list -j .rel.dyn
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds
index 16a9d6ac57..4c9edf8a69 100644
--- a/arch/mips/cpu/u-boot.lds
+++ b/arch/mips/cpu/u-boot.lds
@@ -60,27 +60,7 @@ SECTIONS
__rel_dyn_end = .;
}
- .deadcode : {
- /*
- * Workaround for a binutils feature (or bug?).
- *
- * The GNU ld from binutils puts the dynamic relocation
- * entries into the .rel.dyn section. Sometimes it
- * allocates more dynamic relocation entries than it needs
- * and the unused slots are set to R_MIPS_NONE entries.
- *
- * However the size of the .rel.dyn section in the ELF
- * section header does not cover the unused entries, so
- * objcopy removes those during stripping.
- *
- * Create a small section here to avoid that.
- */
- LONG(0xffffffff);
- }
-
- .dynsym : {
- *(.dynsym)
- }
+ _end = .;
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
@@ -91,15 +71,39 @@ SECTIONS
__bss_end = .;
}
- /DISCARD/ : {
+ .dynsym _end : {
+ *(.dynsym)
+ }
+
+ .dynbss : {
*(.dynbss)
+ }
+
+ .dynstr : {
*(.dynstr)
+ }
+
+ .dynamic : {
*(.dynamic)
+ }
+
+ .plt : {
+ *(.plt)
+ }
+
+ .interp : {
*(.interp)
+ }
+
+ .gnu : {
+ *(.gnu*)
+ }
+
+ .MIPS.stubs : {
+ *(.MIPS.stubs)
+ }
+
+ .hash : {
*(.hash)
- *(.gnu.*)
- *(.plt)
- *(.got.plt)
- *(.rel.plt)
}
}
OpenPOWER on IntegriCloud