From: Joakim Tjernlund Date: Thu, 25 Dec 2008 15:00:47 +0100 Subject: [U-Boot] [RFC][PATCH] Code Clean-up (weak functions) In-Reply-To: <49526969.5000402@ruby.dti.ne.jp> References: <1229145986-9936-1-git-send-email-graeme.russ@gmail.com> <49518CF0.2040903@necel.com> <005501c965d1$a95ceee0$fc16cca0$@Tjernlund@transmode.se> <49526969.5000402@ruby.dti.ne.jp> Message-ID: <001101c96699$30076430$90162c90$@Tjernlund@transmode.se> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > -----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