
Graeme Russ graeme.russ@gmail.com wrote on 2010/03/27 12:54:03:
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
Are we talking about the same thing? when you say "does not need to be loaded at TEXT_BASE" you need something like my LINK_OFF patch, otherwise I don't see how you can boot out of flash otherwise.
Jocke