On Friday 10 July 2009, Frans Pop wrote: > I've proposed the attached patch on lkml: > http://lkml.org/lkml/2009/7/10/49.
The version check in the patch was incorrect. Here's an improved version that also allows -fwrapv for gcc 4.2. See also the follow ups on lkml.
From: Frans Pop <elen...@planet.nl> Subject: Only add '-fwrapv' to gcc CFLAGS for gcc 4.2 and later This flag has been shown to cause init to segfault for kernels compiled with gcc-4.1. gcc version 4.2.4 has been shown to be OK. This fixes http://bugzilla.kernel.org/show_bug.cgi?id=13012. Reported-by: Barry K. Nathan <bar...@pobox.com> Signed-off-by: Frans Pop <elen...@planet.nl> diff --git a/Makefile b/Makefile index 0aeec59..2519fde 100644 --- a/Makefile +++ b/Makefile @@ -565,7 +565,8 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) # disable invalid "can't wrap" optimizations for signed / pointers -KBUILD_CFLAGS += $(call cc-option,-fwrapv) +KBUILD_CFLAGS += $(shell if [ $(call cc-version) -ge 0402 ]; then \ + echo $(call cc-option,-fwrapv); fi ;) # revert to pre-gcc-4.4 behaviour of .eh_frame KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)