public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC: 2.6 patch] add -fno-tree-scev-cprop to KBUILD_CFLAGS
@ 2007-11-11  6:48 Adrian Bunk
  2007-11-11  7:34 ` Paul Mundt
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Adrian Bunk @ 2007-11-11  6:48 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel

The gcc from svn that will become gcc 4.3 generates libgcc calls in 
cases like the following (on 32bit architectures):

<--  snip  -->

static inline void timespec_add_ns(struct timespec *a, u64 ns)
{
...
        while(ns >= NSEC_PER_SEC) {
                ns -= NSEC_PER_SEC;
                a->tv_sec++;
        }
...

<--  snip  -->

It can make sense to emit assembler code doing division for such C code -
that doesn't seem to be something that would generally be wrong.

But the kernel does (at least on some architectures) not link with 
libgcc or ship other code providing the required libgcc functions.

Richard Guenther suggested in gcc bug #32044 to use -fno-tree-scev-cprop 
(new option in gcc 4.3) as a workaround and I confirmed that it fixes 
the compilation.

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

---
f2357fcb8addd855f1be6ac9fdf4ef3c3ab8256d 
diff --git a/Makefile b/Makefile
index e28dde8..9d8a831 100644
--- a/Makefile
+++ b/Makefile
@@ -527,6 +527,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
+# workaround to avoid gcc 4.3 emitting libgcc calls (see gcc bug #32044)
+KBUILD_CFLAGS += $(call cc-option,-fno-tree-scev-cprop,)
+
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 # But warn user when we do so
 warn-assign = \


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-11-13 11:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-11  6:48 [RFC: 2.6 patch] add -fno-tree-scev-cprop to KBUILD_CFLAGS Adrian Bunk
2007-11-11  7:34 ` Paul Mundt
2007-11-12  6:14   ` the kernel, gcc and libgcc Adrian Bunk
2007-11-12 16:24 ` [RFC: 2.6 patch] add -fno-tree-scev-cprop to KBUILD_CFLAGS Bernd Schmidt
2007-11-12 16:40   ` Adrian Bunk
2007-11-12 22:07     ` Bernd Schmidt
2007-11-13  6:04       ` Adrian Bunk
2007-11-12 16:58 ` Jakub Jelinek
2007-11-13 11:39   ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox