[U-Boot] [PATCH] relocation: Do not relocate NULL pointers.

Peter Tyser ptyser at xes-inc.com
Wed Sep 23 14:17:51 CEST 2009


On Wed, 2009-09-23 at 13:51 +0200, Joakim Tjernlund wrote:
> NULL is an absolute value and should not be relocated.
> After this correction code like:
>  void weak_fun(void) __attribute__((weak));
>  printf("weak_fun:%p\n", weak_fun);
> will still print null after relocation.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
> ---
> 
> I have only tested this on 83xx and on a somewhat older u-boot.
> The change is exactly the same on all PowerPC platforms though.

Hi Jocke,
I made the same changes recently, but ran into an "issue" that prevented
me from sending the change upstream.  Some boards/arches have the bss at
address 0 and later relocate it, unlike every other NULL pointer.  If
you don't fix up the bss address, the board will not function.   If you
run readelf on an 83xx u-boot image vs a 85xx u-boot image it should be
more clear what's going on.  I was doing my testing on the XPedite5370
fwiw.

In any case, the change as is would break some other arches.  Seems like
the proper workaround would be to "fix" the 85xx (and other arches) link
script to locate the bss similar to the 83xx boards.

It might be nice to consolidate all the ppc relocate code into 1
function while we were at it.

Best,
Peter



More information about the U-Boot mailing list