[U-Boot] [RFC][PATCH] Code Clean-up (weak functions)

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Thu Dec 25 15:00:47 CET 2008


> -----Original Message-----
> From: Shinya Kuribayashi [mailto:skuribay at ruby.dti.ne.jp]
> Sent: den 24 december 2008 17:55
> To: Joakim Tjernlund
> Cc: 'Shinya Kuribayashi'; 'Graeme Russ'; u-boot at lists.denx.de
> Subject: Re: [U-Boot] [RFC][PATCH] Code Clean-up (weak functions)
> 
> Joakim Tjernlund wrote:
> >>> - There is no purely weak functions and therfore no longer code like:
> >>>     if (do_something)
> >>>       do_somthing();
> >>>   All instances have been replaced by empty functions with an alias. e.g.
> >>>      void __do_something (args) {}
> >>>      do_something(args) __atttribute__((weak, alias("__do_something")));
> >
> > Curious as to why you removed such code? Was it because it didn't work? If
> > so I might have an answer for that. See my post:
> > "Re: [U-Boot] [PATCH V4] cmd_bdinfo: move implementation to	arch	instead of common"
> >
> >  Jocke
> 
> Good to know.  This doc also helps:
> 
> http://docs.sun.com/app/docs/doc/817-1984/chapter2-11?l=en&a=view
> 
> Then,
> - we must try to not leave undefined weak symbols at all,
> - or check the symbol before invocation for the safety in case of NULL
>   dereference.

Checking for NULL before invocation won't work unless you fix the relocation
routine not to relocate NULL values. That is what I have been trying to say
several times now. That fix should be performed regardless so no nasty
surprises will happen in the future. Perhaps there are other cases besides
weak symbols too.
You can either fix the assembler routine in all start.S or make all relevant
boards use the C-versions I posted.

   Jocke 



More information about the U-Boot mailing list