
2013/2/11 Gabor Juhos juhosg@openwrt.org:
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.
Erm, the presence of the .deadcode section does not change the size of the .rel.dyn section.
The ELF headers shows that there is a gap between the .rel.dyn and the .deadcode section:
[ 6] .rel.dyn REL bfc30804 030864 0015f8 08 A 8 0 4 [ 7] .deadcode PROGBITS bfc31f74 031fd4 000004 00 WA 0 0 1
However objcopy will copy the .deadcode section into the final binary because it is placed after the .rel.dyn section, and the gap will be filled with 0xff bytes.
As a result, the size of u-boot.bin will equal to (__rel_dyn_end - __start + 4), and this ensures that it will contain the full .rel.dyn section.
ok. I guess I misunderstood the intention of your workaround. My goal was to minimize the increase of image size caused by PIE.
I'll send a v2 of patch 6/7 with the .deadcode section.