[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32
From: |
Paul Brook |
Subject: |
Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32 |
Date: |
Sun, 31 Jul 2005 00:04:27 +0100 |
User-agent: |
KMail/1.7.2 |
> 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
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: ;\
- [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Steve D. Perkins, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Paul Brook, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Steve D. Perkins, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Christian MICHON, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Steve D. Perkins, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Filip Navara, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32,
Paul Brook <=
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Steve D. Perkins, 2005/07/30
- Re: [Qemu-devel] [Patch Submission] QEMU with GCC/Win32, Paul Brook, 2005/07/30