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

Segher Boessenkool segher at kernel.crashing.org
Fri May 30 21:47:09 EST 2008


> Workaround gcc (4.1.1) problem with __weak 'empty' functions

4.1.x with x < 2

> The compiler is optimizing weak functions that are empty.

It considers for inlining all weak functions that are pure
functions.

> This
> patch prevents the function from being optimized by the compiler
> as it is not longer empty.

[...] no longer pure.

> 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.

Are these compiler versions not supported anymore?

>  void __init __weak thread_info_cache_init(void)
>  {
> +	/* Should be replaced by linker for PPC */
> +	BUG_ON(1);
>  }

The   asm("")   solution is much clearer (and potentially compiles
to better code).  Also, please add a comment saying a) this is a
workaround; b) workaround for what; c) how the workaround works.

Thanks,


Segher




More information about the cbe-oss-dev mailing list