On Tue, Mar 28, 2006 at 12:56:13AM +0200, Dieter Schuster wrote: > Hello, > > the version 0.8.0 of qemu in the Debian-pool will not compile on > PowerPC with GCC 3.4. The following patch will fix it:
And suck performance wise with exploding code size. Without speaking of potential atomicity issues (although all architectures using the byte per byte generic code may hit the problem). > > --- cpu-all.h~ 2005-12-19 23:51:53.000000000 +0100 > +++ cpu-all.h 2006-03-27 22:47:54.291613000 +0200 > @@ -249,15 +249,11 @@ > > static inline void stl_le_p(void *ptr, int v) > { > -#ifdef __powerpc__ > - __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" > (v), "r" (ptr)); > -#else > uint8_t *p = ptr; > p[0] = v; > p[1] = v >> 8; > p[2] = v >> 16; > p[3] = v >> 24; > -#endif > } > > static inline void stq_le_p(void *ptr, uint64_t v) > > > If I use GCC 3.3, then qemu compiles with the assembler instruction in > the patch above, but qemu does not work correctly (tested with Knoppix V5.0). Interesting, could it be an aliasing problem? Try to compile with -fno-strict-aliasing, although I doubt it will change anything. > > If I try to compile qemu with GCC 3.4 without the patch I get the following > error: > > qemu-0.8.0/linux-user/elfload.c: In function `load_elf_binary': > qemu-0.8.0/cpu-all.h:253: error: inconsistent operand constraints in an `asm' > qemu-0.8.0/cpu-all.h:253: error: inconsistent operand constraints in an `asm' Weird. CC'ed to gcc list despite the fact that the 3.4 branch is definitely closed. I've not found anything remotely similar from bugzilla. > > But if I copy the function stl_le_p to a seperate file, the function > will compile with GCC 3.4. Which gcc-3.4 (gcc -v)? > > Is this a bug in qemu, or is it a bug in GCC 3.4? It looks like a compiler bug. But you should provide an environment independent test case, i.e., the preprocessed source. Please try also to provide a minimal failing test case (it may be hard given the symptoms). Regards, Gabriel