Skip to contentSkip to conversation

MIPS: keep all sections in u-boot ELF binary.

PATCH New Daniel Schwierzeck 1 participant 1 message Feb 14, 2014 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: keep all sections in u-boot ELF binary.

The current MIPS linker script discards all unneeded sections in the link stage. For diagnostic tools like readelf it is better to keep all sections in the ELF binary and only remove them when creating the final binary.

Move all unneeded sections after _end to avoid allocating space in the final binary. Also remove .deadcode section which is now obsolete.

---
This patch is inspired by a similar one for ARM [1]. This patch is queued at u-boot-mips/testing together with a test patch. This test patch adds a script for testing for the "wrong __rel_dyn_end offset" bug, which could occur without the .deadcode section.

[1] http://patchwork.ozlabs.org/patch/289329/

---
 arch/mips/config.mk      |  3 ++-
 arch/mips/cpu/u-boot.lds | 56 ++++++++++++++++++++++++++----------------------
 2 files changed, 32 insertions(+), 27 deletions(-)
arch/mips/config.mk +2 -1
index c3f81b5..ce438c2 100644
@@ -50,4 +50,5 @@ PLATFORM_CPPFLAGS		+= -msoft-float
 PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib $(ENDIANNESS)
 PLATFORM_RELFLAGS		+= -ffunction-sections -fdata-sections
 LDFLAGS_FINAL			+= --gc-sections -pie
-OBJCFLAGS			+= --remove-section=.dynsym
+OBJCFLAGS			+= -j .text -j .rodata -j .data -j .got
+OBJCFLAGS			+= -j .u_boot_list -j .rel.dyn
arch/mips/cpu/u-boot.lds +30 -26

72 lines not on this page · raw message

Signature · 1 line
1.8.3.2