This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem Installing Linux Kernel Module compiled with gcc-3.2.x
On Fri, May 30, 2003 at 07:22:40PM +0200, Bernd Jendrissek wrote:
> If you look at linux/include/linux/spinlock.h, you'll see:
>
> /*
> * Your basic spinlocks, allowing only a single CPU anywhere
> *
> * Most gcc versions have a nasty bug with empty initializers.
> */
> #if (__GNUC__ > 2)
> typedef struct { } spinlock_t;
> #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
> #else
> typedef struct { int gcc_is_buggy; } spinlock_t;
> #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
> #endif
Yuk! What is the benefit of introducing this incompatibility? #ifdefs
are harmful to maintainance, and it's only one word, so why not always
put in the dummy struct member?
> Hmm, actually I thought the kernel had a mechanism to prevent a GCC 3.x
> module from being loaded into a GCC 2.x kernel and vice versa?
Is there any reason, other than the above-described bit of evil, for doing
this (forbidding mixing)? It prevents the bug-finding approach I
described earlier (a binary search for finding miscompiled code) from
working.