Skip to content

i386 Relocation

Graeme Russ u-boot 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 0 repliesNew
  2. v110 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10Fix dlmalloc compile warningboard/eNET/config.mk+1 -01 reply
2/10Fix i386 malloc initialisationcommon/dlmalloc.c include/configs/eNET.h include/configs/sc520_cdp.h +2 more+10 -171 reply
3/10Fix link collisions resulting from gcc4.4.1 upgradeboard/eNET/config.mk+1 -01 reply
4/10Reorder source objects in lib_i386 Makefilelib_i386/Makefile+4 -41 reply
5/10Fix global label in inline asm compile errorinclude/configs/eNET.h+2 -20 replies
6/10Fix race condition when using SC520 timerscpu/i386/sc520/sc520_timer.c+6 -51 reply
7/10Rearrange i386 Interupt Handlingcpu/i386/Makefile cpu/i386/cpu.c cpu/i386/exceptions.c +5 more+420 -3101 reply
8/10Remove inline asm symbols from .dynsymboard/eNET/eNET_start16.S cpu/i386/cpu.c cpu/i386/interrupts.c +2 more+80 -01 reply
9/10Move references to link script exportsinclude/asm-i386/u-boot-i386.h lib_i386/bios_setup.c lib_i386/board.c +1 more+11 -171 reply
10/10Final i386 Relocationboard/eNET/config.mk board/eNET/eNET.c board/eNET/u-boot.lds +8 more+163 -2171 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [U-Boot] [PATCH v2 00/10] i386 Relocation

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.