From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JQL7t-0007KN-8u for qemu-devel@nongnu.org; Sat, 16 Feb 2008 06:22:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JQL7o-0007JU-Jn for qemu-devel@nongnu.org; Sat, 16 Feb 2008 06:22:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JQL7o-0007JR-Cw for qemu-devel@nongnu.org; Sat, 16 Feb 2008 06:22:32 -0500 Received: from py-out-1112.google.com ([64.233.166.181]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JQL7n-0005nL-W7 for qemu-devel@nongnu.org; Sat, 16 Feb 2008 06:22:32 -0500 Received: by py-out-1112.google.com with SMTP id u52so1199274pyb.10 for ; Sat, 16 Feb 2008 03:22:31 -0800 (PST) Message-ID: Date: Sat, 16 Feb 2008 12:22:30 +0100 From: "Christian Roue" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_833_28574114.1203160950412" Subject: [Qemu-devel] Patch for compiling with GCC 4 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_833_28574114.1203160950412 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all, I tried to compile qemu cvs head on my x86_64 linux with gcc 4.1.2 using --disable-gcc-check, I found compile fails as stated in configure before i disabled gcc check.. Error message, points to a problem of dyngen not correctly detecting function ends on i386 when last instruction is a jump. I applied following change and successfully compiled/run qemu i386. This extra test check for a relative backward jump to function exit ret, gcc 4 apparently generates a few of these. My small change to cvs head is : --- dyngen.c 2008-02-13 18:54:36.000000000 +0100 +++ dyngen.c 2008-02-13 19:10:14.000000000 +0100 @@ -1474,7 +1474,7 @@ len = p_end - p_start; if (len == 0) error("empty code for %s", name); - if (p_end[-1] == 0xc3) { + if (p_end[-1] == 0xc3 || p_end[-2] == 0xeb) { len--; } else { error("ret or jmp expected at the end of %s", name); Bye Chris. ------=_Part_833_28574114.1203160950412 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all,
I tried to compile qemu cvs head on my x86_64 linux with gcc 4.1.2 using --disable-gcc-check, I found compile fails as stated in configure before i disabled gcc check..
Error message, points to a problem of dyngen not correctly detecting function ends on i386 when last instruction is a jump. I applied following change and successfully compiled/run qemu i386.  This extra test check for  a relative backward jump  to function exit ret,
gcc 4 apparently generates a few of these.

My small change to cvs head is :

--- dyngen.c       2008-02-13 18:54:36.000000000 +0100
+++ dyngen.c    2008-02-13 19:10:14.000000000 +0100
@@ -1474,7 +1474,7 @@
         len = p_end - p_start;
         if (len == 0)
             error("empty code for %s", name);
-        if (p_end[-1] == 0xc3) {
+        if (p_end[-1] == 0xc3 || p_end[-2] == 0xeb) {
             len--;
         } else {
             error("ret or jmp expected at the end of %s", name);

Bye
Chris.

------=_Part_833_28574114.1203160950412--