[U-Boot] ARM relocation, question to Heiko

Albert ARIBAUD albert.aribaud at free.fr
Mon Oct 4 08:40:06 CEST 2010


Le 04/10/2010 08:08, Heiko Schocher a écrit :
> Hello Albert,
>
> Albert ARIBAUD wrote:
>> Le 03/10/2010 20:03, Wolfgang Denk a écrit :
>>
>>> Dear Reinhard Meyer,
>>>
>>> In message<4CA6E8E5.2090605 at emk-elektronik.de>   you wrote:
>>>>> And yes, this means the content arrays of pointers such as init_sequence
>>>>> is not relocated. Been there, done that, can give you one of the
>>>>> tee-shirts I got :)
>>> It should work.
>>>
>>> Eventually we need to find out which sort of tweaking of compiler
>>> and/or linker options is needed on ARM.
>>
>> While looking for enhancements to Heiko's arm relocation patches, I have
>> gone through all relocation related compiler and linker options, and
>> then some. -fPIC / -fPIE will not generate GOT fixups for data
>> containing pointers, and I have found no additional option that will.
>
> Yep, that was also my problem ...
>
>> OTOH, -pie will generate this kind of fixup (and all others needed) in
>> the form of .rel.dyn relocations, as Bill describes.
>
> Ah! Have to look in this, maybe thats the way we have to go ...

Right now I can build (not run, mind you) u-boot for edminiv2 without 
-fPIC/-fPIE, with -pie and a modified u-boot.lds and start.S. Almost all 
of the .rel.dyn fixup entries are type 23, that is, relative to the base 
address, which is good. However, here are about ten at the end which are 
type 2 -- symbol-relative -- and I am studying them in order to see if 
they are needed.

If type 23 relocations are all that is needed, then a first ARM ELF 
relocation implementation should 'simply' trade GOT vs .rel.dyn 
relocation in start.S (I am almost there) and remove fixups in 
board_init_r. Start.S would apply type 23 fixups only and ignore the 
rest. Later on we could add a build stage to rewrite the .rel.dyn 
section as suggested, by filtering out non-type-23 relocs and keeping 
only the address part of type-23 ones, reducing the .rel.dyn table 
roughly by half.

The good news is, I can spare a couple more hours today on this. I'll 
let you all know how this fares!

> bye,
> Heiko

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list