[U-Boot] [PATCH v2 00/10] i386 Relocation
Graeme Russ
graeme.russ at gmail.com
Tue Nov 24 10:04:11 CET 2009
Version 2 of previously submitted patch set. The changes are minor
(added missed hiding of irq_common_entry in patch 8 and added
#define CONFIG_RELOC_FIXUP_WORKS and setting GD_FLG_RELOC in patch 10)
This patch series implements full relocation support for the i386 port of
U-Boot.
The first 5 patches came about due to my toolchain upgrade (to gcc 4.4.1
and binutils 2.19) (patch 4 id really just a quick tidy-up)
Patch 6 is a standalone bug-fix to resolve a start-up race condition
Patch 7 sets up the i386 interupt handling to be relocation friendly
Patches 8 and 9 are a relocation setup patch - no functionality change
By the end of patch 9, the i386 port is still non-relocatable
Patch 10 is the actual Relocation Patch itself
Relocation is achieved by utilising the -pie ld command line option and
minimal boot-up processing of the resulting .rel.dyn section. By not using
gcc's -fpie flag, the overhead of .got and the call/pop in each function
entry is avoided - This prevents bloat of .text and .got and avoids the
performance penalty of GOT lookups
This relocation scheme is possibly usable on many other arches
Many thanks to Joakim Tjernlund and Bill Campbell for their invaluable
assistance and references.
Size analysis:
Non-Reloc Reloc
-------------------------------------
.text 0x00011970 0x00011850
.plt 0x00000000
.rodata 0x00005bae 0x00005b49
.data 0x00000a5c 0x00000a3c
.interp 0x00000013
.dynsym 0x000000f0
.dynstr 0x00000113
.hash 0x00000050
.got 0x00000000 0x00000000
.got.plt 0x0000000c
.dynamic 0x00000080
.u_boot_cmd 0x000003c0 0x000003c0
.rel.dyn 0x00004190
.bss 0x00001a34 0x00001a34
.realmode 0x00000166 0x00000166
.bios 0x0000053e 0x0000053e
.start16 0x000000bc 0x000000bc
.resetvec 0x00000010 0x00000010
=====================================
0x0001a4de 0x0001e7bb
~17kB increase in binary image size (of which ~16kb is .rel.dyn which is
not copied to RAM). Post processing of .rel.dyn could reduce the overhead
by a further ~8kB - Speed improvement would be negligble and the only
saving would be in image size, not RAM utilisation.
More information about the U-Boot
mailing list