* [Qemu-devel] [PATCH] support for Mac OS X default compiler
@ 2005-12-19 19:36 Joachim Henke
2005-12-19 22:35 ` Fabrice Bellard
0 siblings, 1 reply; 7+ messages in thread
From: Joachim Henke @ 2005-12-19 19:36 UTC (permalink / raw)
To: qemu-devel
I know that you have already discussed this on the list, and that you don't
want to actively support GCC 4. But (at least on Mac OS X) only a fix in
the build configuration is necessary to do the magic: op.c must be compiled
with -fno-tree-ch (as already mentioned on this mailing list).
GCC 4.0 is the default compiler since Mac OS 10.4 (Tiger). Apple still
ships GCC 3.3 20030304 with Xcode 2.2, but doesn't seem to update it
anymore. As the thread
http://lists.gnu.org/archive/html/qemu-devel/2005-12/msg00077.html
turned out, this old compiler has some obvious bugs (further bugs have been
reported on the web - even with code that is less complex than QEMU).
So why not support GCC 4 out of the box? The patch below does this, and
should not hurt anybody. Users are still required to pass
--disable-gcc-check to the configure script - but if they do, GCC 4 will
get it's right command line options.
I tested this with GCC 4.0.1 from Xcode 2.2, and all six softmmu targets
were build without errors. Maybe it works on Linux PPC too?
Would be nice, if you could apply this patch. It makes testing and building
with GCC 4 easier.
Best regards
Jo.
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.90
diff -u -r1.90 Makefile.target
--- Makefile.target 6 Dec 2005 21:42:17 -0000 1.90
+++ Makefile.target 19 Dec 2005 17:54:59 -0000
@@ -151,6 +151,10 @@
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
endif
+ifeq ($(HAVE_GCC4),yes)
+OP_CFLAGS+=-fno-tree-ch
+endif
+
ifeq ($(CONFIG_DARWIN),yes)
OP_CFLAGS+= -mdynamic-no-pic
LIBS+=-lmx
Index: configure
===================================================================
RCS file: /sources/qemu/qemu/configure,v
retrieving revision 1.79
diff -u -r1.79 configure
--- configure 18 Dec 2005 19:14:49 -0000 1.79
+++ configure 19 Dec 2005 17:55:01 -0000
@@ -283,20 +283,23 @@
fi
# Check for gcc4
-if test "$check_gcc" = "yes" ; then
- cat > $TMPC <<EOF
+cat > $TMPC <<EOF
#if __GNUC__ >= 4
#error gcc4
#endif
int main(){return 0;}
EOF
- if ! $cc -o $TMPO $TMPC 2>/dev/null ; then
+
+have_gcc4="no"
+if ! $cc -o $TMPO $TMPC 2>/dev/null ; then
+ if test "$check_gcc" = "yes" ; then
echo "ERROR: \"$cc\" looks like gcc 4.x"
echo "QEMU is known to have problems when compiled with gcc 4.x"
echo "It is recommended that you use gcc 3.x to build QEMU"
echo "To use this compiler anyway, configure with --disable-gcc-check"
exit 1;
fi
+ have_gcc4="yes"
fi
##########################################
@@ -527,6 +530,9 @@
if test "$have_gcc3_options" = "yes" ; then
echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
fi
+if test "$have_gcc4" = "yes" ; then
+ echo "HAVE_GCC4=yes" >> $config_mak
+fi
echo "HOST_CC=$host_cc" >> $config_mak
echo "AR=$ar" >> $config_mak
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] support for Mac OS X default compiler
2005-12-19 19:36 [Qemu-devel] [PATCH] support for Mac OS X default compiler Joachim Henke
@ 2005-12-19 22:35 ` Fabrice Bellard
2005-12-20 4:51 ` Joshua Root
2005-12-20 9:19 ` Daniel Egger
0 siblings, 2 replies; 7+ messages in thread
From: Fabrice Bellard @ 2005-12-19 22:35 UTC (permalink / raw)
To: qemu-devel
Does -fno-tree-ch works on PC ?
Fabrice.
Joachim Henke wrote:
> I know that you have already discussed this on the list, and that you don't
> want to actively support GCC 4. But (at least on Mac OS X) only a fix in
> the build configuration is necessary to do the magic: op.c must be compiled
> with -fno-tree-ch (as already mentioned on this mailing list).
>
> GCC 4.0 is the default compiler since Mac OS 10.4 (Tiger). Apple still
> ships GCC 3.3 20030304 with Xcode 2.2, but doesn't seem to update it
> anymore. As the thread
> http://lists.gnu.org/archive/html/qemu-devel/2005-12/msg00077.html
> turned out, this old compiler has some obvious bugs (further bugs have been
> reported on the web - even with code that is less complex than QEMU).
>
> So why not support GCC 4 out of the box? The patch below does this, and
> should not hurt anybody. Users are still required to pass
> --disable-gcc-check to the configure script - but if they do, GCC 4 will
> get it's right command line options.
>
> I tested this with GCC 4.0.1 from Xcode 2.2, and all six softmmu targets
> were build without errors. Maybe it works on Linux PPC too?
>
> Would be nice, if you could apply this patch. It makes testing and building
> with GCC 4 easier.
>
> Best regards
> Jo.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] support for Mac OS X default compiler
2005-12-19 22:35 ` Fabrice Bellard
@ 2005-12-20 4:51 ` Joshua Root
2005-12-20 9:19 ` Daniel Egger
1 sibling, 0 replies; 7+ messages in thread
From: Joshua Root @ 2005-12-20 4:51 UTC (permalink / raw)
To: qemu-devel
>Does -fno-tree-ch works on PC ?
>>
>>Fabrice.
Yes. According to the GCC docs[1], -ftree-ch is enabled by -O1 and
above on all architectures.
[1] http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Optimize-Options.html
- Josh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] support for Mac OS X default compiler
2005-12-19 22:35 ` Fabrice Bellard
2005-12-20 4:51 ` Joshua Root
@ 2005-12-20 9:19 ` Daniel Egger
2005-12-20 11:16 ` Johannes Schindelin
2005-12-20 11:57 ` Gwenole Beauchesne
1 sibling, 2 replies; 7+ messages in thread
From: Daniel Egger @ 2005-12-20 9:19 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 165 bytes --]
On 19.12.2005, at 23:35, Fabrice Bellard wrote:
> Does -fno-tree-ch works on PC ?
Yes. However using it might introduce a performance hit.
Servus,
Daniel
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] support for Mac OS X default compiler
2005-12-20 9:19 ` Daniel Egger
@ 2005-12-20 11:16 ` Johannes Schindelin
2005-12-21 16:07 ` Joachim Henke
2005-12-20 11:57 ` Gwenole Beauchesne
1 sibling, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2005-12-20 11:16 UTC (permalink / raw)
To: qemu-devel
Hi,
On Tue, 20 Dec 2005, Daniel Egger wrote:
> On 19.12.2005, at 23:35, Fabrice Bellard wrote:
>
> > Does -fno-tree-ch works on PC ?
>
> Yes. However using it might introduce a performance hit.
Why not just test for Darwin *and* for GCC 4, and be done with it?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] support for Mac OS X default compiler
2005-12-20 9:19 ` Daniel Egger
2005-12-20 11:16 ` Johannes Schindelin
@ 2005-12-20 11:57 ` Gwenole Beauchesne
1 sibling, 0 replies; 7+ messages in thread
From: Gwenole Beauchesne @ 2005-12-20 11:57 UTC (permalink / raw)
To: qemu-devel
On Tue, 20 Dec 2005, Daniel Egger wrote:
> On 19.12.2005, at 23:35, Fabrice Bellard wrote:
>
> > Does -fno-tree-ch works on PC ?
>
> Yes. However using it might introduce a performance hit.
I think Fabrice meant does the -fno-tree-ch trick works on x86 with gcc4
too? The answer is no.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] support for Mac OS X default compiler
2005-12-20 11:16 ` Johannes Schindelin
@ 2005-12-21 16:07 ` Joachim Henke
0 siblings, 0 replies; 7+ messages in thread
From: Joachim Henke @ 2005-12-21 16:07 UTC (permalink / raw)
To: qemu-devel
Please note that '-fno-tree-ch' is passed to GCC4 only for compiling
op.c, so that 'dyngen' doesn't fail, when it is working on op.o
afterwards! All other source files are still compiled without this flag.
On x86 GCC4 fails during compilation of op.c anyway. But '-fno-tree-
ch' could also help for Linux PPC and MIPS, SPARC, etc. I would
encourage users of these systems to test, if compiling with GCC4
works with this patch.
This patch shouldn't break anything. It just disables some
optimizations - and only for op.o
Jo.
Johannes Schindelin wrote:
> Hi,
>
> On Tue, 20 Dec 2005, Daniel Egger wrote:
>
>> On 19.12.2005, at 23:35, Fabrice Bellard wrote:
>>
>>> Does -fno-tree-ch works on PC ?
>>
>> Yes. However using it might introduce a performance hit.
>
> Why not just test for Darwin *and* for GCC 4, and be done with it?
>
> Ciao,
> Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-12-21 16:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-19 19:36 [Qemu-devel] [PATCH] support for Mac OS X default compiler Joachim Henke
2005-12-19 22:35 ` Fabrice Bellard
2005-12-20 4:51 ` Joshua Root
2005-12-20 9:19 ` Daniel Egger
2005-12-20 11:16 ` Johannes Schindelin
2005-12-21 16:07 ` Joachim Henke
2005-12-20 11:57 ` Gwenole Beauchesne
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.