Skip to contentSkip to conversation

build failure on x86, any suggestions?

Qemu-devel Peter Volkov 6 participants 10 messages Mar 15, 2008 – Mar 19, 2008 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

The problem gentoo is that previous versions are known to be affected to security vulnerability so we'll have to mask it soon, while version which does not build successfully will be masked too as there is no reason to keep broken package in stable. Could anybody of developers suggest anything on this issue? Thank you very much in advance!

The actual build error:

gcc -Wall -O2 -g -fno-strict-aliasing -fno-reorder-blocks -fno-gcse
-fno-optimize-sibling-calls -fno-crossjumping -fno-align-labels
-fno-align-jumps -fno-align-functions -mpreferred-stack-boundary=2
-fomit-frame-pointer -m32 -I. -I..
-I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386
-I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05 -MMD -MP -DNEED_CPU_H
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/tcg
-I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/tcg/i386
-I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/fpu
-I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/linux-user -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/linux-user/i386 -c -o
op.o /home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/op.c /home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/ops_sse.h:
In function `op_psrlq_mmx':
/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/ops_sse.h:213: error: unable to find a register to spill in class `GENERAL_REGS' /home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/ops_sse.h:213: error: this is the insn:
(insn:HI 36 35 37

3 /home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/ops_sse.h:207 (parallel [
            (set (reg:DI 63 [ <variable>.q ])
                (lshiftrt:DI (reg:DI 63 [ <variable>.q ])
                    (subreg:QI (reg/v:SI 60 [ shift ]) 0)))
            (clobber (scratch:SI))
            (clobber (reg:CC 17 flags))
        ]) 309 {lshrdi3_1} (insn_list 33 (insn_list 35 (nil)))
    (expr_list:REG_DEAD (reg/v:SI 60 [ shift ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (expr_list:REG_UNUSED (scratch:SI)
                (nil)))))
Signature · 1 line
Peter.
#1 lore raw
Quoted 6 lines · Peter Volkov

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

You're almost certainly using gcc4.x. Don't do that.

IIRC gentoo already has a big pile hacks for this. This kind of breakage is exactly why those hacks haven't been merged into cvs. They're papering over the problem rather than fixing it, so you should expect them to need constant maintenance.

As mentioned several times on this recently on this list, the proper fix is to finish the TCG conversion. That will happen "when it's done".

Paul

#2 lore raw

В Сбт, 15/03/2008 в 14:20 +0000, Paul Brook пишет:

Quoted 9 lines · Peter Volkov
Quoted 6 lines

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

You're almost certainly using gcc4.x. Don't do that.

Paul, thank you for you answer. I do have gcc-4 installed on my system but I'm sure that I'm using gcc-3.4:

Quoted 1 line

gcc --version

gcc (GCC) 3.4.6 (Gentoo 3.4.6-r2 p1.5, ssp-3.4.6-1.0, pie-8.7.10)

As I read FAQ this version should be supported. I've tried to build gcc without patches (ssp, pie, C++ support and some gentoo specific patches) but qemu build process still fails at the same place...

Quoted 4 lines

IIRC gentoo already has a big pile hacks for this. This kind of breakage is exactly why those hacks haven't been merged into cvs. They're papering over the problem rather than fixing it, so you should expect them to need constant maintenance.

Sorry, but what hacks are you talking about? The only hack I'm aware about is that all system is build with newer compiler while to build qemu I have to install old gcc.

Quoted 2 lines

As mentioned several times on this recently on this list, the proper fix is to finish the TCG conversion. That will happen "when it's done".

Eh, I saw you talking about this and I'm aware that this will definitely take time. That's why I asked for suggestion...

Signature · 1 line
Peter.
#3 lore raw
Quoted 38 lines · Peter Volkov

В Сбт, 15/03/2008 в 14:20 +0000, Paul Brook пишет:

Quoted 11 lines · Peter Volkov
Quoted 8 lines

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

You're almost certainly using gcc4.x. Don't do that.

Paul, thank you for you answer. I do have gcc-4 installed on my system but I'm sure that I'm using gcc-3.4:

Quoted 2 lines

gcc --version

gcc (GCC) 3.4.6 (Gentoo 3.4.6-r2 p1.5, ssp-3.4.6-1.0, pie-8.7.10)

As I read FAQ this version should be supported. I've tried to build gcc without patches (ssp, pie, C++ support and some gentoo specific patches) but qemu build process still fails at the same place...

Quoted 5 lines

IIRC gentoo already has a big pile hacks for this. This kind of breakage is exactly why those hacks haven't been merged into cvs. They're papering over the problem rather than fixing it, so you should expect them to need constant maintenance.

Sorry, but what hacks are you talking about? The only hack I'm aware about is that all system is build with newer compiler while to build qemu I have to install old gcc.

Quoted 8 lines
Quoted 3 lines

As mentioned several times on this recently on this list, the proper fix is to finish the TCG conversion. That will happen "when it's done".

Eh, I saw you talking about this and I'm aware that this will definitely take time. That's why I asked for suggestion...

For the time being you could try the appended patch. It makes x86 on x86 slower though, but should enable you to have a working build at all. I am not 100% sure if it actually does help in your case though.

Alex

target-i386/op.c +1 -1
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define ASM_SOFTMMU
+//#define ASM_SOFTMMU
 #include "exec.h"
 
 /* n must be a constant to be efficient */

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 9 lines · Peter Volkov

В Сбт, 15/03/2008 в 14:20 +0000, Paul Brook пишет:

Quoted 8 lines · Peter Volkov
Quoted 6 lines

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

Quoted 6 lines
Quoted 1 line

You're almost certainly using gcc4.x. Don't do that.

Paul, thank you for you answer. I do have gcc-4 installed on my system

but I'm sure that I'm using gcc-3.4:

Quoted 1 line

gcc --version

Try setting the compiler flags to use -march=pentium-mmx . That is the max setting for -march that qemu compiles on. also, make sure that the compiler isn't sending any of the -msse functions.

I tried to build qemu using -msse -march=pentium3 and it spat out the same thing.

Quoted 20 lines

gcc (GCC) 3.4.6 (Gentoo 3.4.6-r2 p1.5, ssp-3.4.6-1.0, pie-8.7.10)

As I read FAQ this version should be supported. I've tried to build gcc without patches (ssp, pie, C++ support and some gentoo specific patches) but qemu build process still fails at the same place...

Quoted 4 lines

IIRC gentoo already has a big pile hacks for this. This kind of breakage is exactly why those hacks haven't been merged into cvs. They're papering over the problem rather than fixing it, so you should expect them to need constant maintenance.

Sorry, but what hacks are you talking about? The only hack I'm aware about is that all system is build with newer compiler while to build qemu I have to install old gcc.

Quoted 2 lines

As mentioned several times on this recently on this list, the proper fix is to finish the TCG conversion. That will happen "when it's done".

Eh, I saw you talking about this and I'm aware that this will definitely take time. That's why I asked for suggestion...

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

В Вск, 16/03/2008 в 00:01 -0600, C.W. Betts пишет:

Quoted 6 lines

Try setting the compiler flags to use -march=pentium-mmx . That is the max setting for -march that qemu compiles on. also, make sure that the compiler isn't sending any of the -msse functions.

I tried to build qemu using -msse -march=pentium3 and it spat out the same thing.

Well with -march=pentium-mmx it works, although it occurs that

$ export CFLAGS="-march=pentium-mmx"
is not enough. I have to path CFLAGS to make with
$ emake OS_CFLAGS="${CFLAGS}"
CFLAGS are prefixed at the beginning of the compilation command ands
seems that -g -O2 which will go later redefine something which in turn
cause the build to fail and OS_CFLAGS passes -march after -g -O2.

Also strange thing is that if I try to disable all sse thing in compiler appending -mno-sse{,2,3} -mfpmath=387 qemu does not builds. Either I miss something or sse is not the only problem.

Two patches suggested here by Alexander and Blue did no difference here.

But in any case we have at least one working solution here and it's better than nothing. Your suggestions here were very helpful! Thank you all!

Signature · 1 line
Peter.
#8 lore raw
Quoted 18 lines · Peter Volkov

В Вск, 16/03/2008 в 00:01 -0600, C.W. Betts пишет:

Quoted 6 lines

Try setting the compiler flags to use -march=pentium-mmx . That is the max setting for -march that qemu compiles on. also, make sure that the compiler isn't sending any of the -msse functions.

I tried to build qemu using -msse -march=pentium3 and it spat out the same thing.

Well with -march=pentium-mmx it works, although it occurs that

 $ export CFLAGS="-march=pentium-mmx"
 is not enough. I have to path CFLAGS to make with
 $ emake OS_CFLAGS="${CFLAGS}"
 CFLAGS are prefixed at the beginning of the compilation command ands
 seems that -g -O2 which will go later redefine something which in turn
 cause the build to fail and OS_CFLAGS passes -march after -g -O2.
Quoted 5 lines

Also strange thing is that if I try to disable all sse thing in compiler appending -mno-sse{,2,3} -mfpmath=387 qemu does not builds. Either I miss something or sse is not the only problem.

Two patches suggested here by Alexander and Blue did no difference here.

Please try this patch and if it fails, report also the compiler error message.

I'm trying to find the range of instructions that need to be converted to TCG helpers.

target-i386/op.c +2 -0
Index: qemu/target-i386/op.c
===================================================================
@@ -2222,11 +2222,13 @@
     *(uint32_t *)(env->fptags + 4) = 0x01010101;
 }
 
+#if 0
 #define SHIFT 0
 #include "ops_sse.h"
 
 #define SHIFT 1
 #include "ops_sse.h"
+#endif
 
 /* Secure Virtual Machine ops */
 
target-i386/translate.c +6 -1
Index: qemu/target-i386/translate.c
===================================================================
@@ -2407,6 +2407,7 @@
 #endif
 };
 
+#if 0
 #define SSE_SPECIAL ((GenOpFunc2 *)1)
 
 #define MMX_OP2(x) { gen_op_ ## x ## _mmx, gen_op_ ## x ## _xmm }
@@ -3174,7 +3175,7 @@
         }
     }
 }
-
+#endif
 
 /* convert one instruction. s->is_jmp is set if the translation must
    be stopped. Return the next pc value */
@@ -6252,7 +6253,9 @@
     case 0x1c2:
     case 0x1c4 ... 0x1c6:
     case 0x1d0 ... 0x1fe:
+#if 0
         gen_sse(s, b, pc_start, rex_r);
+#endif
         break;
     default:
         goto illegal_op;
@@ -6427,11 +6430,13 @@
     [INDEX_op_imull_T0_T1] = CC_OSZAPC,
     X86_64_DEF([INDEX_op_imulq_T0_T1] = CC_OSZAPC,)
 
+#if 0
     /* sse */
     [INDEX_op_ucomiss] = CC_OSZAPC,
     [INDEX_op_ucomisd] = CC_OSZAPC,
     [INDEX_op_comiss] = CC_OSZAPC,
     [INDEX_op_comisd] = CC_OSZAPC,
+#endif
 
     /* bcd */
     [INDEX_op_aam] = CC_OSZAPC,
#9 lore raw
Quoted 23 lines · Blue Swirl
Quoted 22 lines · Peter Volkov

В Вск, 16/03/2008 в 00:01 -0600, C.W. Betts пишет:

Quoted 8 lines

Try setting the compiler flags to use -march=pentium-mmx . That is the max

setting for -march that qemu compiles on. also, make sure that the compiler isn't sending any of the -msse functions.

I tried to build qemu using -msse -march=pentium3 and it spat out the same thing.

Well with -march=pentium-mmx it works, although it occurs that

 $ export CFLAGS="-march=pentium-mmx"
 is not enough. I have to path CFLAGS to make with
 $ emake OS_CFLAGS="${CFLAGS}"
 CFLAGS are prefixed at the beginning of the compilation command ands
 seems that -g -O2 which will go later redefine something which in turn
 cause the build to fail and OS_CFLAGS passes -march after -g -O2.

Also strange thing is that if I try to disable all sse thing in compiler appending -mno-sse{,2,3} -mfpmath=387 qemu does not builds. Either I miss something or sse is not the only problem.

Quoted 7 lines
Quoted 1 line

Two patches suggested here by Alexander and Blue did no difference here.

Please try this patch and if it fails, report also the compiler error message.

I'm trying to find the range of instructions that need to be converted to TCG helpers.

Okay, the patch makes op.c and translate.c compile. I did have a problem with trying to get the makefile to compile op.c with the additional flags, but I worked around it.
However, now the helper.c file spits out:
gcc-3.4 -fomit-frame-pointer -I. -I.. -I/home/test/makestuff/qemu-patched/target-i386 -I/home/test/makestuff/qemu-patched -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/test/makestuff/qemu-patched/tcg -I/home/test/makestuff/qemu-patched/tcg/i386 -I/home/test/makestuff/qemu-patched/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/test/makestuff/qemu-patched/slirp -mfpmath=sse -march=pentium3 -msse -Wall -O2 -g -fno-strict-aliasing -mfpmath=sse -march=pentium3 -msse -m32 -c -o helper.o /home/test/makestuff/qemu-patched/target-i386/helper.c /home/test/makestuff/qemu-patched/target-i386/helper.c: In function `svm_check_intercept_param':
/home/test/makestuff/qemu-patched/target-i386/helper.c:4375: error: unable to find a register to spill in class `GENERAL_REGS'
/home/test/makestuff/qemu-patched/target-i386/helper.c:4375: error: this is the insn:
(insn:HI 353 352 354 39 /home/test/makestuff/qemu-patched/target-i386/helper.c:4368 (parallel [

            (set (reg:DI 167 [ <variable>.intercept ])
                (lshiftrt:DI (reg:DI 167 [ <variable>.intercept ])
                    (subreg:QI (reg:SI 166) 0)))
            (clobber (scratch:SI))
            (clobber (reg:CC 17 flags))
        ]) 309 {lshrdi3_1} (insn_list 351 (insn_list 352 (nil)))
    (expr_list:REG_DEAD (reg:SI 166)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (expr_list:REG_UNUSED (scratch:SI)
                (nil)))))

/home/test/makestuff/qemu-patched/target-i386/helper.c:4375: confused by earlier errors, bailing out
make: *** [helper.o] Error 1
This is only on the i386 target. When I compile the x86_64 target, it works just fine.

#10 lore raw
In reply to Paul Brook
Quoted 15 lines · Paul Brook
Quoted 6 lines · Peter Volkov

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

You're almost certainly using gcc4.x. Don't do that.

IIRC gentoo already has a big pile hacks for this. This kind of breakage is exactly why those hacks haven't been merged into cvs. They're papering over the problem rather than fixing it, so you should expect them to need constant maintenance.

Quoted 4 lines

As mentioned several times on this recently on this list, the proper fix is to finish the TCG conversion. That will happen "when it's done".

Paul

Hi Paul,

I got two similar error messages from other users. Both were using gcc-3.4, one of them from ubuntu 7.10 (32bit). My own system had no problems compiling exactly the same version with Debian lenny (amd64) gcc-3.4.

Stefan

#11 lore raw
In reply to Peter Volkov
Quoted 16 lines · Peter Volkov

Hello.

I just wanted to point developers attention to the following bug:
bugs.gentoo.org/212351 , comment #11 and further. The problem is that qemu does not compile any more on x86. I've tried recent snapshot (2008-03-15_05) and the problem persist there.

The problem gentoo is that previous versions are known to be affected to security vulnerability so we'll have to mask it soon, while version which does not build successfully will be masked too as there is no reason to keep broken package in stable. Could anybody of developers suggest anything on this issue? Thank you very much in advance!

The actual build error:

Quoted 15 lines

gcc -Wall -O2 -g -fno-strict-aliasing -fno-reorder-blocks -fno-gcse -fno-optimize-sibling-calls -fno-crossjumping -fno-align-labels
-fno-align-jumps -fno-align-functions -mpreferred-stack-boundary=2
-fomit-frame-pointer -m32 -I. -I.. -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386 -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05 -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/tcg -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/tcg/i386 -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/fpu -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/linux-user -I/home/pva/work/qemu/qemu-snapshot-2008-03-15_05/linux-user/i386 -c -o op.o /home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/op.c /home/pva/work/qemu/qemu-snapshot-2008-03-15_05/target-i386/ops_sse.h:
In function `op_psrlq_mmx':

I can't replicate this bug, but does this patch (NB: not a real fix) make the compile successful or does it fail later somewhere else?

target-i386/ops_sse.h +2 -0
Index: qemu/target-i386/ops_sse.h
===================================================================
@@ -191,6 +191,7 @@
 
 void OPPROTO glue(op_psrlq, SUFFIX)(void)
 {
+#if 0
     Reg *d, *s;
     int shift;
 
@@ -210,6 +211,7 @@
 #endif
     }
     FORCE_RET();
+#endif
 }
 
 void OPPROTO glue(op_psllq, SUFFIX)(void)