
2013/2/11 Gabor Juhos juhosg@openwrt.org:
2013.02.09. 21:33 keltezéssel, daniel.schwierzeck@gmail.com írta:
From: Gabor Juhos juhosg@openwrt.org
This section contain the table needed for dynamic relocation. Also provide symbols for the relocation code to access the table.
Discard all sections which are not needed in the final ELF binary and U-Boot image. Section .dynsym cannot be discarded or GNU ld crashes otherwise. This section will be stripped by GNU objcpy in a later patch.
Signed-off-by: Gabor Juhos juhosg@openwrt.org Signed-off-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com
arch/mips/cpu/u-boot.lds | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds index 4cd983a..cea9533 100644 --- a/arch/mips/cpu/u-boot.lds +++ b/arch/mips/cpu/u-boot.lds @@ -70,7 +70,17 @@ SECTIONS . = ALIGN(4); __image_copy_end = .;
.bss : {
.rel.dyn : {
__rel_dyn_start = .;
*(.rel.dyn)
__rel_dyn_end = .;
}
.dynsym : {
*(.dynsym)
}
This is not enough to avoid the binutils issue I have mentioned in the original patch. The issue is present after applying this series.
The following example comes from the qemu_mips target compiled with the ELDK 5.3 toolchain:
$ mips-linux-objdump --disassemble u-boot | grep bfc005[67] bfc00560: 00000000 nop bfc00564: bfc31f74 cache 0x3,8052(s8) <--- __rel_dyn_end
The offset of __rel_dyn_end: 0x0bfc31f74 - 0xbfc00000 = 0x31f74 = 204660
bfc00568: bfc30804 cache 0x3,2052(s8) bfc0056c: bfc30804 cache 0x3,2052(s8) bfc00570: bfc2fa70 cache 0x2,-1424(s8) bfc00574: 000001df 0x1df bfc00578 <in_ram>: bfc00578: 8d0bfffc lw t3,-4(t0) bfc0057c: 8d0cfff8 lw t4,-8(t0)
$ ls -l u-boot.bin -rw-r--r-- 1 juhosg root 204284 Feb 11 11:29 u-boot.bin
204660 - 204284 = 376 bytes are missing from the final u-boot.bin.
-Gabor
that's weird. Actually I checked after each patch if the *_end symbols match the U-Boot binary size. Now I checked again with different toolchains (gcc-4.[5,6,7], binutils-2.[21.53,22] and I have again that binutils issue.
But all toolchains have one in common (tested with qemu_mips): __rel_dyn_end - __rel_dyn_start = 0x1770 size from readelf = 0x15f8
Another problem is that your .deadcode workaround does not work anymore for me. It does not matter how I arrange or drop the unneeded sections, the size of .rel.dyn remains at 0x1770. I'll try to find another solution.