Subject: Re: any hints using gcc 3.4.3 for 2.4.25 kernel?

From: Ralph Siemsen <[email-masked]>
Date: Mon, 21 Feb 2005 09:28:32 -0500

Wojciech Kromer wrote:
> a)first i have:
> - 2.4.25 kernel (from denx cvs)
> - eldk with 2.95.4 compiler
> this one set works fine :)
> 
> b)then, i've tried  to same sources with:
> gcc-3.4.3 , self build from uClibc buildroot
> new hernel hangs just after decompressing :(

I haven't tried this on PPC, but under similar circumstances on ARM what 
I learned was: there are several places in the kernel where lists are 
generated by some linker tricks.  For example all of the device 
initialization functions are assembled into a list, so they can be 
conveniently called in sequence.

The semantics for getting the linker to fill this list have changed.  In 
2.4 days they used ELF sections marked as "unnused", which were simply 
ignored but passed through.

Newer toolchains now drop unnused sections, so the initialization tables 
are not present in your kernel, which leads to the crash.  I was able 
kludge around this by changing in <asm/setup.h> and <linux/init.h>, 
search for __attribute__((unused, ...) and change to "used" instead. 
There are about half dozen occurrences, in the __init* and __exit* 
macros.  You then need some ugly casts in <linux/module.h> to match.

Of course the same thing could happen in other places/drivers, so really 
  the above is not a good solution.  New 2.6 kernels handle this sort of 
thing in a different way.  Best solution is to keep an older gcc for 
older kernels, and a newer one for 2.6...

-Ralph