[2.6.26 patch] #error for gcc 4.1.{0,1}

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Andrew Morton <akpm@...>, <venkatesh.pallipadi@...>, <davem@...>, <trini@...>, <hpa@...>, <linux-kernel@...>, <suresh.b.siddha@...>
Date: Thursday, June 26, 2008 - 6:37 am

On Thu, May 01, 2008 at 03:27:26PM -0700, Linus Torvalds wrote:

Some talk and one and a half months later we still don't abort the build 
for these gcc version.

If anyone has a better patch please step forward - otherwise I'd propose 
the patch below.


cu
Adrian


<--  snip  -->


gcc 4.1.0 and 4.1.1 are known to miscompile the kernel:
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27781

Usage of weak functions has become a common pattern in the kernel, and 
usages get added in each kernel version increasing the probability of 
bugs with each kernel release.

This miscompilation of weak functions can result in subtle runtime 
errors.

#error for gcc 4.1.0 and 4.1.1 to prevent users from running into
this bug.

Note:
We already printed a #warning for gcc 4.1.0 due to a different bug.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
ee78871a1d85fe60958748c208389adb4031fefe diff --git a/init/main.c b/init/main.c
index f7fb200..bede344 100644
--- a/init/main.c
+++ b/init/main.c
@@ -76,8 +76,9 @@
  * trouble.
  */
 
-#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0
-#warning gcc-4.1.0 is known to miscompile the kernel.  A different compiler version is recommended.
+/*  due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27781  */
+#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
+#error gcc 4.1.0 and 4.1.1 are known to miscompile the kernel.
 #endif
 
 static int kernel_init(void *);

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] /dev/mem gcc weak function workaround, Venki Pallipadi, (Tue Apr 29, 9:31 pm)
Re: [PATCH] /dev/mem gcc weak function workaround, David Miller, (Wed Apr 30, 12:28 am)
RE: [PATCH] /dev/mem gcc weak function workaround, Pallipadi, Venkatesh, (Wed Apr 30, 8:49 am)
huge gcc 4.1.{0,1} __weak problem, Adrian Bunk, (Thu May 1, 5:56 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Jeremy Fitzhardinge, (Fri May 2, 5:09 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Adrian Bunk, (Fri May 2, 5:19 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Andrew Morton, (Thu May 1, 6:20 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Linus Torvalds, (Thu May 1, 6:27 pm)
[2.6.26 patch] #error for gcc 4.1.{0,1}, Adrian Bunk, (Thu Jun 26, 6:37 am)
Re: huge gcc 4.1.{0,1} __weak problem, David Miller, (Thu May 1, 6:51 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Venki Pallipadi, (Thu May 1, 6:35 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Tom Rini, (Thu May 1, 7:23 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Andrew Morton, (Thu May 1, 6:42 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Tom Rini, (Thu May 1, 7:21 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Venki Pallipadi, (Thu May 1, 7:30 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Linus Torvalds, (Thu May 1, 8:34 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Suresh Siddha, (Thu May 1, 8:39 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Jeremy Fitzhardinge, (Fri May 2, 5:11 pm)
Re: huge gcc 4.1.{0,1} __weak problem, David Miller, (Fri May 2, 6:02 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Jakub Jelinek, (Thu May 1, 6:49 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Andrew Morton, (Thu May 1, 6:33 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Tom Rini, (Thu May 1, 7:24 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Andrew Morton, (Thu May 1, 7:59 pm)
Re: huge gcc 4.1.{0,1} __weak problem, Andi Kleen, (Fri May 2, 5:09 am)
Re: huge gcc 4.1.{0,1} __weak problem, Adrian Bunk, (Fri May 2, 4:10 am)
Re: huge gcc 4.1.{0,1} __weak problem, Vegard Nossum, (Fri May 2, 3:18 am)
Re: huge gcc 4.1.{0,1} __weak problem, Theodore Tso, (Fri May 2, 9:43 am)
Re: huge gcc 4.1.{0,1} __weak problem, Justin Mattock, (Thu May 1, 8:21 pm)
Re: [PATCH] /dev/mem gcc weak function workaround, Tom Rini, (Wed Apr 30, 4:15 pm)