[U-Boot] ARM relocation, question to Heiko

Peter Tyser
2010-10-04T04:43:02Z

Hi Wolfgang,

<snip>

> Well, please keep in mind that all this code is working find on
> PowerPC, which has been using relocation right from the beginning.
>
> It is my understanding that we don't suffer from this issue any more
> on PPC - Peter Tyser posted relocation fixup patches for PPC about a
> year ago or so.
>
> I have to admit that I cannot remeber the final result of this
> discussion (there were tool chain dependencies?), but IIRC this has
> been solved for PPC.
>
> We should do the same for AMR now.
>
>
> Peter, could you please fill in the details of that old story?

I haven't been following the ARM relocation thread very closely, but a
summary of the PPC relocation is:
- Prior to commit 858290178f222d998b6425d85cf06822467918f3 PPC supported
basic relocation, but didn't relocate static pointers, eg pointers in a
structure, such as the strings in the cmd_pca953x[] table. So we had to
use the hokey "struct->field += gd->reloc_off" fixups that we still have
for some arches.

- Adding "-mrelocatable" to the gcc's flags would add additional
relocation info into the ".fixup" section that allowed us to properly
fixup static pointers and get rid of the "+= gd->reloc_off" fixups. The
additional fixup code was relatively small, in the 1-2% ballpark I
think.

- Unfortunately "-mrelocatable" is PPC specific. I remember dabbling
with other, more general relocation flags like -fPIC, pie, etc, but went
with -mrelocatable mainly because it was a smaller, easier change. We
could share the already-used relocation fixup code in many PPC arch's
start.S, so it wasn't too hard to get working unlike the other
relocation schemes.

- Graeme Russ was working on relocation for x86 near the same time. He
started this thread which may provide useful info:
http://www.mail-archive.com/u-boot at lists.denx.de/msg23347.html He
discusses the impact of other compile flags, most of which were generic
so could apply to this ARM discussion hopefully.

Regards,
Peter