[U-Boot] ARM relocation, question to Heiko

Wolfgang Denk wd at denx.de
Mon Oct 4 19:06:14 CEST 2010


Dear "J. William Campbell",

In message <4CA9F294.8080007 at comcast.net> you wrote:
>
> Yes, I think Wolfgang is correct. This is not going to be easy to do in 
> general.  To run anywhere, the code must be true Position Independent 
> code. If you intend to use any C code in the initialization, this will 
> result in needing -fPIC for at least that code. I am not sure you can 
> mix -fPIC and non -fPIC code in the same link, but I expect not. I am a 
> bit surprised that it is possible to get even the initialization code to 
> be Position Independent, but it appears that on at least some PPC it is 
> possible/has been done.

Not really. On PowerPC, only the first 20 or 30 lines of assembler
code in start.S are position independent; then we compute the link
(resp. execution) address and branch to it. From then, we run from the
very address range we were linked for (starting at TEXT_BASE).

> Albert is doing now, and Graeme did before,  is the first option, 
> creating a loader that understands ELF. This has the advantage that it 
> will work on all architectures. However, once this understanding is in 
> place, it would be easy to write a small post-processing program that 
> would reduce the size of the relocation entries, much like -mrelocatable 
> does. This may or may not be necessary, but it is certainly possible.

Eventually we might even add -mrelocatable support for the other
architectures to the tool chain.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Its always easier short term to pee in the pond
than install a toilet - it's just not a good long term plan.
          - Alan Cox in <20100101145701.6432e7b7 at lxorguk.ukuu.org.uk>


More information about the U-Boot mailing list