[U-Boot] [RFC][PATCH 00/21] [x86] 'Comming of Age'

Graeme Russ
2010-03-27T11:54:03Z

Joakim Tjernlund wrote:
>> In the near future, I intend to make it 100% relocatable (i.e. does not
>> need to be loaded at TEXT_BASE) and maybe even add the ability to specify
>> the relocation address.
>
> I did a few months ago for MPC83xx and sent it to the list. There was some
> discussion but in the end it wasn't applied because it was too invasive.
> PPC is especially bad as it needs to relocate string literals too.
>
> Search for LINK_OFF if you want to see what I did
>

Yes, I saw a bit of that thread and you patches an I would agree that they
were too invasive. x86 is not that great for relocation either (all calls
are absolute as well as references to .text). Have a look at board_init_f()
in lib_i386\board.c - it has a very basic parsing of the ELF relocation
information.

I tried to champion this as a cross-platform method of achieving full
relocation and the killing off of all those ugly reloc_off hacks all over
the place. Unfortunately, I think the code size and time penalty may have
been too great in the end.

To implement full relocation, I simply need to add an additional parameter
to this function which provides the 'link versus load' offset which will
get applied to the 'load versus run' offset calculation