[lkml]   [2009]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: Linux

On Mon, 20 Jul 2009, Greg KH wrote:
> > >Linus Torvalds (1):
> > > Don't use '-fwrapv' compiler option: it's buggy in gcc-4.1.x
> >
> > I'm very sorry to say that but compiled with gcc-4.2.4
> > hangs during boot and it is caused by this fix.
> >
> > I extended with
> > additional info & .config.
> Wierd. Linus, any thoughts? Do we need to check the version of the
> compiler that we are using before turning that option off?

Dang. That was what we hoped to avoid by not using -fwrapv - we didn't
know which compilers were buggy, although it _looked_ like just 4.1.x (I
have some dim memory of somebody suspecting a 4.2.x version too, but that
may have been just a "we know it should only be needed in 4.3.x, so maybe
we shouldn't use it in 4.2.x either").

But it looks like the "buggy window" for -fno-strict-overflow is
potentially even _larger_ than it ever was with -fwrapv. And I suspect
that in both cases the real problem is that almost nobody ever uses either
optimization flag, so coverage is way way smaller.

For now, I suspect we need to do something like this: go back to -fwrapv
(because it has gotten more testing), but limit it to 4.2.x and newer.

However, it would be really good to figure out _why_ it breaks. It's
probably some specific configuration issue in addition to the particular
kernel vesion (and maybe it even needs some particular hardware to show
the bug - ie a specific driver that triggers it or whatever).


Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 79957b3..47a3a1a 100644
--- a/Makefile
+++ b/Makefile
@@ -566,7 +566,7 @@ 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,-fno-strict-overflow)
+KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0402, -fwrapv)

# revert to pre-gcc-4.4 behaviour of .eh_frame
KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)

 \ /
  Last update: 2009-10-18 23:28    [W:0.085 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site