Disallow gcc versions 4.1.{0,1}

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, January 2, 2009 - 10:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f9d142...
Commit:     f9d14250071eda9972e4c9cea745a11185952114
Parent:     f153b82121b0366fe0e5f9553545cce237335175
Author:     Linus Torvalds <torvalds@linux-foundation.org>
AuthorDate: Fri Jan 2 09:29:43 2009 -0800
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri Jan 2 09:29:43 2009 -0800

    Disallow gcc versions 4.1.{0,1}
    
    These compiler versions are known to miscompile __weak functions and
    thus generate kernels that don't necessarily work correctly.  If a weak
    function is int he same compilation unit as a caller, gcc may end up
    inlining it, and thus binding the weak function too early.
    
    See
    
        http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27781
    
    for details.
    
    Cc: Adrian Bunk <bunk@kernel.org>
    Cc: Helge Deller <deller@gmx.de>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 include/linux/compiler-gcc4.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index aa42621..0999271 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -2,6 +2,11 @@
 #error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
 #endif
 
+/* GCC 4.1.[01] miscompiles __weak */
+#if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
+# error Your version of gcc miscompiles the __weak directive
+#endif
+
 #define __used			__attribute__((__used__))
 #define __must_check 		__attribute__((warn_unused_result))
 #define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Disallow gcc versions 4.1.{0,1}, Linux Kernel Mailing ..., (Fri Jan 2, 10:59 am)