qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org, Fabrice Bellard <fabrice@bellard.org>
Subject: Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32
Date: Sun, 31 Jul 2005 00:04:27 +0100	[thread overview]
Message-ID: <200507310004.28470.paul@codesourcery.com> (raw)
In-Reply-To: <42EBD7E3.7090409@steveperkins.net>

[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]

>     I'm not sure what you mean about the patch "not being necessary".  I
> haven't tried building with Cygwin, so I can't speak for that platform.
> My build environment is MinGW with the MSYS shell (to avoid onerous
> licensing issues and DLL dependencies), and I can assure that the patch
> very much is necessary for the current release of QEMU with the current
> release of MinGW.  QEMU does compile fine on Win32 with GCC 3.4, but the
> executable crashes immediately when you try to run it.  By applying the
> patch I just posted, you get an executable that compiles and runs
> properly (I've been running a FreeBSD environment just fine with a build
> from the 0.7.1 patch I just posted).

"sledgehammer" and "nut" spring to mind :-)

The attached patch is sufficient to get qemu working on win32 when compiled 
with gcc3.4. I've successfully booted a knoppix CD inside qemu on a windows 
host with this patch.

The problem was that gcc is choosing inconvenient names for static local 
variables.  These symbols are never supposed to be seen outside the compiler, 
so it's allowed to change these at random. The solution is to use explicitly 
specify the asm name for the variable.

Paul

[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1591 bytes --]

Index: exec-all.h
===================================================================
RCS file: /cvsroot/qemu/qemu/exec-all.h,v
retrieving revision 1.34
diff -u -p -r1.34 exec-all.h
--- exec-all.h	24 Jul 2005 14:14:53 -0000	1.34
+++ exec-all.h	30 Jul 2005 22:56:09 -0000
@@ -320,13 +320,16 @@ TranslationBlock *tb_find_pc(unsigned lo
 #define ASM_PREVIOUS_SECTION ".previous\n"
 #endif
 
+#define ASM_OP_LABEL_NAME(n, opname) \
+    ASM_NAME(__op_label) #n "." ASM_NAME(opname)
+
 #if defined(__powerpc__)
 
 /* we patch the jump instruction directly */
 #define GOTO_TB(opname, tbparam, n)\
 do {\
     asm volatile (ASM_DATA_SECTION\
-		  ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
+		  ASM_OP_LABEL_NAME(n, opname) ":\n"\
 		  ".long 1f\n"\
 		  ASM_PREVIOUS_SECTION \
                   "b " ASM_NAME(__op_jmp) #n "\n"\
@@ -339,7 +342,7 @@ do {\
 #define GOTO_TB(opname, tbparam, n)\
 do {\
     asm volatile (".section .data\n"\
-		  ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
+		  ASM_OP_LABEL_NAME(n, opname) ":\n"\
 		  ".long 1f\n"\
 		  ASM_PREVIOUS_SECTION \
                   "jmp " ASM_NAME(__op_jmp) #n "\n"\
@@ -353,7 +356,8 @@ do {\
 #define GOTO_TB(opname, tbparam, n)\
 do {\
     static void __attribute__((unused)) *dummy ## n = &&dummy_label ## n;\
-    static void __attribute__((unused)) *__op_label ## n = &&label ## n;\
+    static void __attribute__((unused)) *__op_label ## n \
+        __asm__(ASM_OP_LABEL_NAME(n, opname)) = &&label ## n;\
     goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\
 label ## n: ;\
 dummy_label ## n: ;\

  parent reply	other threads:[~2005-07-30 23:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-30 18:42 [Qemu-devel] [Patch Submission] QEMU with GCC/Win32 Steve D. Perkins
2005-07-30 19:13 ` Paul Brook
2005-07-30 19:41   ` Steve D. Perkins
2005-07-30 21:16     ` Filip Navara
2005-07-30 21:28     ` Christian MICHON
2005-07-30 23:04       ` Steve D. Perkins
2005-07-30 23:04     ` Paul Brook [this message]
2005-07-30 23:16       ` Steve D. Perkins
2005-07-30 23:39         ` Paul Brook
2005-08-01 11:34           ` Gwenole Beauchesne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507310004.28470.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).