From: Bernd Jendrissek <berndj@prism.co.za>
To: Joe Buck <jbuck@synopsys.com>
Cc: Kendrick Hamilton <hamilton@sedsystems.ca>,
gcc@gcc.gnu.org, linux-kernel@vger.kernel.org
Subject: Re: Problem Installing Linux Kernel Module compiled with gcc-3.2.x
Date: Fri, 30 May 2003 20:43:32 +0200 [thread overview]
Message-ID: <20030530204332.C7564@prism.co.za> (raw)
In-Reply-To: <20030530103329.A848@synopsys.com>
On Fri, May 30, 2003 at 10:33:29AM -0700, Joe Buck wrote:
> 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?
I dont speak for the kernel people, but...
I suppose some people just insist on squeezing every last cycle out of
their machines. For my home PC (a 486 with 5MB RAM running linux 2.0.30),
I am quite grateful for such cycle and bit saving. Believe me, I notice
whether I have apache running or not. :)
Hmm, yes, it does seem to be just one word. grep -r spinlock_t . |wc -l
says 1013 here, that's across *all* architectures. IOW 4052 bytes - that's
*one page* - on i386!
Never mind what definition tcc will give to __GNUC__
So there I thought I was going to justify the kernel. Instead I mostly
agree with Joe! I'm also sure there have been flamewars about this...
> > 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.
Between GCC 2.x and 3.x the *major* version changed (duh). I would
imagine that people are/were (justifiably?) concerned that ABI's might
have changed. From your response, I assume there are no ABI changes
for C at least? I suppose a gratuitous ABI change would constitute a
bug, though...
BTW I said "I thought" - it appears there is in fact no such mechanism.
Okay, so here's a PR (Public Relations, not Problem Report) patch just
for you, Joe: <with a fistful of smileys :)>
(It also gets rid of some of that crazy 2-space indentation.)
diff -u linux/include/linux/spinlock.h.borig linux/include/linux/spinlock.h
--- linux/include/linux/spinlock.h.borig Tue May 13 17:05:57 2003
+++ linux/include/linux/spinlock.h Fri May 30 20:29:42 2003
@@ -53,13 +53,8 @@
*
* 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
+typedef struct { int gcc_was_buggy; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) (void)(lock) /* Not "unused variable". */
next prev parent reply other threads:[~2003-05-30 18:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44.0305300919510.3613-100000@sw-55.sedsystems.ca>
2003-05-30 17:22 ` Problem Installing Linux Kernel Module compiled with gcc-3.2.x Bernd Jendrissek
2003-05-30 17:31 ` Kendrick Hamilton
2003-05-30 18:02 ` Bernd Jendrissek
2003-05-30 17:33 ` Joe Buck
2003-05-30 18:43 ` Bernd Jendrissek [this message]
2003-05-30 19:02 ` Joe Buck
2003-05-30 19:36 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030530204332.C7564@prism.co.za \
--to=berndj@prism.co.za \
--cc=gcc@gcc.gnu.org \
--cc=hamilton@sedsystems.ca \
--cc=jbuck@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox