From: Linus Torvalds Date: Fri, 2 Jan 2009 17:29:43 +0000 (-0800) Subject: Disallow gcc versions 4.1.{0,1} X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=f9d14250071eda9972e4c9cea745a11185952114;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: Helge Deller Cc: Rusty Russell Cc: Ingo Molnar Signed-off-by: Linus Torvalds --- diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index aa426214331b..09992718f9e8 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h @@ -2,6 +2,11 @@ #error "Please don't include directly, include 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)