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

Stefan Roese sr at denx.de
Wed Sep 23 14:25:25 CEST 2009


On Wednesday 23 September 2009 14:17:51 Peter Tyser wrote:
> 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.

Yes, please!
 
Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de


More information about the U-Boot mailing list