[Cbe-oss-dev] [HACK 1:10] Workaround gcc (4.1.1) problem with __weak 'empty' functions

Michael Ellerman michael at ellerman.id.au
Fri May 23 11:23:24 EST 2008


On Thu, 2008-05-22 at 20:08 +0000, Luke Browning wrote:
> Workaround gcc (4.1.1) problem with __weak 'empty' functions
> 
> The compiler is optimizing weak functions that are empty.  This 
> patch prevents the function from being optimized by the compiler
> as it is not longer empty.   
> 
> This enabled me to boot the 2.6.26-rc3 kernel on a cell machine.
> 
> Note this is not a proper solution and is just being provided
> to workaround a boot problem.  You may or may not have this problem
> depending on the level of the compiler that you use.
> 
> Don't submit upstream.
> 
> Index: linux-2.6.25/init/main.c
> ===================================================================
> --- linux-2.6.25.orig/init/main.c
> +++ linux-2.6.25/init/main.c
> @@ -529,6 +529,8 @@ void __init __weak smp_setup_processor_i
>  
>  void __init __weak thread_info_cache_init(void)
>  {
> +	/* Should be replaced by linker for PPC */
> +	BUG_ON(1);
>  }

I heard asm("") worked. That would be a little less gross.

There are other weak functions in the kernel, so cross your fingers :)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20080523/11a5210a/attachment.pgp>


More information about the cbe-oss-dev mailing list