[U-Boot] ARM relocation, question to Heiko

Graeme Russ graeme.russ at gmail.com
Sun Oct 3 01:07:16 CEST 2010


On 03/10/10 08:09, Albert ARIBAUD wrote:
> Le 02/10/2010 22:39, Reinhard Meyer a écrit :
> 
>> And as an idea, if position independent code is used, only pointers
>> in initialized data need adjustment. Cannot the linker emit a table
>> of addresses that need fixing?
> 
> IIU Bill C, yes the linker can emit the information and the startup code 
> could use this information instead of relying on hand-provided info; the 
> linker file probably needs to be modified in order to provide such info. 
> I intend to look into this, but feel free to do too.
> 

As mentioned previously, I have already done this for x86. The linker flags
used are -pic and --emit-relocs. The linker produces a section named
rel.dyn which needs to be processed but not loaded into RAM. rel.dyn
contains a simple list of address (within .text, .data, .rodata etc) each
of which need a simple adjustment equal to the relocation offset.

The size increase of the code + data loaded into RAM is 104012 bytes to
104296 bytes which is only 284 bytes or a mere 0.3% (which is negligible)
with an additional 22424 bytes in rel.dyn (22%) not loaded into RAM

The additional bonus is that .got is not referenced during run-time, so
there is no run-time performance penalty. However, the penalty of
processing 2803 relocation records at startup may not be wholly recovered
during a typical u-boot run-time session.

All this is for x86, and may not apply so neatly to other arches

Regards,

Graeme


More information about the U-Boot mailing list