qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] support for Mac OS X default compiler


From: Joachim Henke
Subject: [Qemu-devel] [PATCH] support for Mac OS X default compiler
Date: Mon, 19 Dec 2005 20:36:35 +0100

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]