qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
@ 2013-03-29 17:20 Stefan Weil
  2013-03-29 17:58 ` Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Stefan Weil @ 2013-03-29 17:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil

The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not support
__sync_val_compare_and_swap by default.

Using -march=i686 fixes that and should also result in better code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

Maybe this modification is also needed for native gcc-4.4 and older
on Linux i386. If yes, we can move the new script code out of the
MinGW conditional code.

Newer versions of gcc obviously use -march=i686 by default and
don't need the patch, but it also won't do any harm for those
versions.

Stefan


 configure |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure b/configure
index f2af714..70c2219 100755
--- a/configure
+++ b/configure
@@ -562,6 +562,11 @@ if test "$mingw32" = "yes" ; then
   QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
   # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
   QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
+  if test "$cpu" = "i386"; then
+    # We need something better than i386 for __sync_val_compare_and_swap
+    # and can expect that QEMU will only run on i686 or later.
+    QEMU_CFLAGS="-march=i686 $QEMU_CFLAGS"
+  fi
   LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
 cat > $TMPC << EOF
 int main(void) { return 0; }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-03-29 17:20 [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol) Stefan Weil
@ 2013-03-29 17:58 ` Peter Maydell
  2013-03-30 13:44   ` Blue Swirl
  2013-03-30 18:54 ` Blue Swirl
  2013-05-10 20:14 ` Igor Mitsyanko
  2 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2013-03-29 17:58 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

On 29 March 2013 17:20, Stefan Weil <sw@weilnetz.de> wrote:
> Maybe this modification is also needed for native gcc-4.4 and older
> on Linux i386. If yes, we can move the new script code out of the
> MinGW conditional code.

There are at least a few people who want to run on older
CPUs still (though the use of rdtsc doesn't help there, and
we never did figure out how to identify whether we were
compiling on a CPU which has rdtsc.)

-- PMM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-03-29 17:58 ` Peter Maydell
@ 2013-03-30 13:44   ` Blue Swirl
  2013-03-30 13:50     ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Blue Swirl @ 2013-03-30 13:44 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Stefan Weil, qemu-devel

On Fri, Mar 29, 2013 at 5:58 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 29 March 2013 17:20, Stefan Weil <sw@weilnetz.de> wrote:
>> Maybe this modification is also needed for native gcc-4.4 and older
>> on Linux i386. If yes, we can move the new script code out of the
>> MinGW conditional code.
>
> There are at least a few people who want to run on older
> CPUs still (though the use of rdtsc doesn't help there, and
> we never did figure out how to identify whether we were
> compiling on a CPU which has rdtsc.)

Maybe for Linux (embedded i486 or whatsit). But host CPUs older than
i686 with Windows? We don't support Win2k as a host, would WinXP
support < i686?

>
> -- PMM
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-03-30 13:44   ` Blue Swirl
@ 2013-03-30 13:50     ` Peter Maydell
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2013-03-30 13:50 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Stefan Weil, qemu-devel

On 30 March 2013 13:44, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Fri, Mar 29, 2013 at 5:58 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 29 March 2013 17:20, Stefan Weil <sw@weilnetz.de> wrote:
>>> Maybe this modification is also needed for native gcc-4.4 and older
>>> on Linux i386. If yes, we can move the new script code out of the
>>> MinGW conditional code.
>>
>> There are at least a few people who want to run on older
>> CPUs still (though the use of rdtsc doesn't help there, and
>> we never did figure out how to identify whether we were
>> compiling on a CPU which has rdtsc.)
>
> Maybe for Linux (embedded i486 or whatsit). But host CPUs older than
> i686 with Windows? We don't support Win2k as a host, would WinXP
> support < i686?

Yes, I should have been clearer, I meant specifically for Linux,
since Stefan was suggesting widening the change to Linux too.

-- PMM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-03-29 17:20 [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol) Stefan Weil
  2013-03-29 17:58 ` Peter Maydell
@ 2013-03-30 18:54 ` Blue Swirl
  2013-05-10 20:14 ` Igor Mitsyanko
  2 siblings, 0 replies; 9+ messages in thread
From: Blue Swirl @ 2013-03-30 18:54 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Thanks, applied.

On Fri, Mar 29, 2013 at 5:20 PM, Stefan Weil <sw@weilnetz.de> wrote:
> The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not support
> __sync_val_compare_and_swap by default.
>
> Using -march=i686 fixes that and should also result in better code.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> Maybe this modification is also needed for native gcc-4.4 and older
> on Linux i386. If yes, we can move the new script code out of the
> MinGW conditional code.
>
> Newer versions of gcc obviously use -march=i686 by default and
> don't need the patch, but it also won't do any harm for those
> versions.
>
> Stefan
>
>
>  configure |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index f2af714..70c2219 100755
> --- a/configure
> +++ b/configure
> @@ -562,6 +562,11 @@ if test "$mingw32" = "yes" ; then
>    QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
>    # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
>    QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
> +  if test "$cpu" = "i386"; then
> +    # We need something better than i386 for __sync_val_compare_and_swap
> +    # and can expect that QEMU will only run on i686 or later.
> +    QEMU_CFLAGS="-march=i686 $QEMU_CFLAGS"
> +  fi
>    LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
>  cat > $TMPC << EOF
>  int main(void) { return 0; }
> --
> 1.7.10.4
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-03-29 17:20 [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol) Stefan Weil
  2013-03-29 17:58 ` Peter Maydell
  2013-03-30 18:54 ` Blue Swirl
@ 2013-05-10 20:14 ` Igor Mitsyanko
  2013-05-11  6:41   ` Stefan Weil
  2 siblings, 1 reply; 9+ messages in thread
From: Igor Mitsyanko @ 2013-05-10 20:14 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Blue Swirl, Peter Maydell, aliguori, qemu-devel

On 29.03.2013 21:20, Stefan Weil wrote:
> The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not support
> __sync_val_compare_and_swap by default.
>
> Using -march=i686 fixes that and should also result in better code.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> Maybe this modification is also needed for native gcc-4.4 and older
> on Linux i386. If yes, we can move the new script code out of the
> MinGW conditional code.
>
> Newer versions of gcc obviously use -march=i686 by default and
> don't need the patch, but it also won't do any harm for those
> versions.
>
> Stefan
>

mingw is built with --build=mingw32 and looks like it defaults to 
-march=i386 (I have gcc version 4.7.2).
Default build on windows is broken without this patch, it should be
applied to 1.5 probably.

Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>

>
>   configure |    5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index f2af714..70c2219 100755
> --- a/configure
> +++ b/configure
> @@ -562,6 +562,11 @@ if test "$mingw32" = "yes" ; then
>     QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
>     # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
>     QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
> +  if test "$cpu" = "i386"; then
> +    # We need something better than i386 for __sync_val_compare_and_swap
> +    # and can expect that QEMU will only run on i686 or later.
> +    QEMU_CFLAGS="-march=i686 $QEMU_CFLAGS"
> +  fi
>     LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
>   cat > $TMPC << EOF
>   int main(void) { return 0; }
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-05-10 20:14 ` Igor Mitsyanko
@ 2013-05-11  6:41   ` Stefan Weil
  2013-05-11  9:01     ` Igor Mitsyanko
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Weil @ 2013-05-11  6:41 UTC (permalink / raw)
  To: Igor Mitsyanko; +Cc: Blue Swirl, Peter Maydell, aliguori, qemu-devel

Am 10.05.2013 22:14, schrieb Igor Mitsyanko:
> On 29.03.2013 21:20, Stefan Weil wrote:
>> The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not
>> support
>> __sync_val_compare_and_swap by default.
>>
>> Using -march=i686 fixes that and should also result in better code.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>
>> Maybe this modification is also needed for native gcc-4.4 and older
>> on Linux i386. If yes, we can move the new script code out of the
>> MinGW conditional code.
>>
>> Newer versions of gcc obviously use -march=i686 by default and
>> don't need the patch, but it also won't do any harm for those
>> versions.
>>
>> Stefan
>>
>
> mingw is built with --build=mingw32 and looks like it defaults to
> -march=i386 (I have gcc version 4.7.2).
> Default build on windows is broken without this patch, it should be
> applied to 1.5 probably.
>
> Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
>

With latest QEMU, -march=i486 is used and there should be no problem.
If there still is a problem, we have to look for the reason.

Could you please post the output from configure?

Regards,
Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-05-11  6:41   ` Stefan Weil
@ 2013-05-11  9:01     ` Igor Mitsyanko
  2013-05-11 19:51       ` Stefan Weil
  0 siblings, 1 reply; 9+ messages in thread
From: Igor Mitsyanko @ 2013-05-11  9:01 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Blue Swirl, Peter Maydell, aliguori, qemu-devel

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

On 11.05.2013 10:41, Stefan Weil wrote:
> Am 10.05.2013 22:14, schrieb Igor Mitsyanko:
>> On 29.03.2013 21:20, Stefan Weil wrote:
>>> The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not
>>> support
>>> __sync_val_compare_and_swap by default.
>>>
>>> Using -march=i686 fixes that and should also result in better code.
>>>
>>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>>> ---
>>>
>>> Maybe this modification is also needed for native gcc-4.4 and older
>>> on Linux i386. If yes, we can move the new script code out of the
>>> MinGW conditional code.
>>>
>>> Newer versions of gcc obviously use -march=i686 by default and
>>> don't need the patch, but it also won't do any harm for those
>>> versions.
>>>
>>> Stefan
>>>
>> mingw is built with --build=mingw32 and looks like it defaults to
>> -march=i386 (I have gcc version 4.7.2).
>> Default build on windows is broken without this patch, it should be
>> applied to 1.5 probably.
>>
>> Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
>>
> With latest QEMU, -march=i486 is used and there should be no problem.
> If there still is a problem, we have to look for the reason.
>
> Could you please post the output from configure?
>
> Regards,
> Stefan
>

Right, looks like my configuration has __sync_fetch_and_and but doesn't 
have __sync_val_compare_and_swap. That's why configure check passes but 
build fails:

   LINK  arm-softmmu/qemu-system-armw.exe
../migration.o: In function `migrate_finish_set_state':
g:\qemu_develop_ws\qemu_upstream/migration.c:293: undefined reference to 
`__sync_val_compare_and_swap_4'
g:\qemu_develop_ws\qemu_upstream/migration.c:293: undefined reference to 
`__sync_val_compare_and_swap_4'
g:\qemu_develop_ws\qemu_upstream/migration.c:293: undefined reference to 
`__sync_val_compare_and_swap_4'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [qemu-system-armw.exe] Error 1
make: *** [subdir-arm-softmmu] Error 2

[-- Attachment #2: configure.txt --]
[-- Type: text/plain, Size: 2777 bytes --]

$ ./configure --target-list=arm-softmmu
Install prefix    c:/Program Files/QEMU
BIOS directory    c:/Program Files/QEMU
binary directory  c:/Program Files/QEMU
library directory c:/Program Files/QEMU/lib
libexec directory c:/Program Files/QEMU/libexec
include directory c:/Program Files/QEMU/include
config directory  c:/Program Files/QEMU
local state directory   c:/Program Files/QEMU
Source path       /g/qemu_develop_ws/qemu_upstream
C compiler        cc
Host C compiler   cc
Objective-C compiler cc
CFLAGS            -O2 -D_FORTIFY_SOURCE=2 -g
QEMU_CFLAGS       -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS
=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-st
rict-aliasing  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit
-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all  -IC:/ming
w/include/libpng14   -IC:/mingw/include/pixman-1
LDFLAGS           -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase -Wl,--warn-common -m32 -g
make              make
install           install
python            python
smbd              /usr/sbin/smbd
host CPU          i386
host big endian   no
target list       arm-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
-Werror enabled   no
pixman            system
SDL support       yes
GTK support       no
curses support    no
curl support      yes
mingw32 support   yes
Audio drivers     winwave
Block whitelist
Mixer emulation   no
VirtFS support    no
VNC support       yes
VNC TLS support   no
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
VNC WS support    no
xen support       no
brlapi support    no
bluez  support    no
Documentation     yes
NPTL support      no
GUEST_BASE        yes
PIE               no
vde support       no
Linux AIO support no
ATTR/XATTR support no
Install blobs     yes
KVM support       no
TCG interpreter   no
fdt support       no
preadv support    no
fdatasync         no
madvise           no
posix_madvise     no
sigev_thread_id   no
uuid support      no
libcap-ng support no
vhost-net support no
vhost-scsi support no
Trace backend     nop
Trace output file trace-<pid>
spice support     no (/)
rbd support       no
xfsctl support    no
nss used          no
libusb            no
usb net redir     no
GLX support       no
libiscsi support  no
build guest agent yes
seccomp support   no
coroutine backend win32
GlusterFS support no
virtio-blk-data-plane no
gcov              gcov
gcov enabled      no
TPM support       no
libssh2 support   no
TPM passthrough   no

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol)
  2013-05-11  9:01     ` Igor Mitsyanko
@ 2013-05-11 19:51       ` Stefan Weil
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Weil @ 2013-05-11 19:51 UTC (permalink / raw)
  To: Igor Mitsyanko; +Cc: Blue Swirl, Peter Maydell, aliguori, qemu-devel

Am 11.05.2013 11:01, schrieb Igor Mitsyanko:
> On 11.05.2013 10:41, Stefan Weil wrote:
>> Am 10.05.2013 22:14, schrieb Igor Mitsyanko:
>>> On 29.03.2013 21:20, Stefan Weil wrote:
>>>> The cross i586-mingw32msvc-gcc 4.4.4 from Debian Squeeze does not
>>>> support
>>>> __sync_val_compare_and_swap by default.
>>>>
>>>> Using -march=i686 fixes that and should also result in better code.
>>>>
>>>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>>>> ---
>>>>
>>>> Maybe this modification is also needed for native gcc-4.4 and older
>>>> on Linux i386. If yes, we can move the new script code out of the
>>>> MinGW conditional code.
>>>>
>>>> Newer versions of gcc obviously use -march=i686 by default and
>>>> don't need the patch, but it also won't do any harm for those
>>>> versions.
>>>>
>>>> Stefan
>>>>
>>> mingw is built with --build=mingw32 and looks like it defaults to
>>> -march=i386 (I have gcc version 4.7.2).
>>> Default build on windows is broken without this patch, it should be
>>> applied to 1.5 probably.
>>>
>>> Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
>>>
>> With latest QEMU, -march=i486 is used and there should be no problem.
>> If there still is a problem, we have to look for the reason.
>>
>> Could you please post the output from configure?
>>
>> Regards,
>> Stefan
>>
>
> Right, looks like my configuration has __sync_fetch_and_and but
> doesn't have __sync_val_compare_and_swap. That's why configure check
> passes but build fails:
>
>   LINK  arm-softmmu/qemu-system-armw.exe
> ../migration.o: In function `migrate_finish_set_state':
> g:\qemu_develop_ws\qemu_upstream/migration.c:293: undefined reference
> to `__sync_val_compare_and_swap_4'
> g:\qemu_develop_ws\qemu_upstream/migration.c:293: undefined reference
> to `__sync_val_compare_and_swap_4'
> g:\qemu_develop_ws\qemu_upstream/migration.c:293: undefined reference
> to `__sync_val_compare_and_swap_4'
> collect2.exe: error: ld returned 1 exit status
> make[1]: *** [qemu-system-armw.exe] Error 1
> make: *** [subdir-arm-softmmu] Error 2

Hi,

I can reproduce that problem with a native MinGW.
http://patchwork.ozlabs.org/patch/243150/ should fix it.

Thank you for your report.

Regards,
Stefan Weil

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-05-11 19:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-29 17:20 [Qemu-devel] [PATCH] w32: Fix build with older gcc (unresolved symbol) Stefan Weil
2013-03-29 17:58 ` Peter Maydell
2013-03-30 13:44   ` Blue Swirl
2013-03-30 13:50     ` Peter Maydell
2013-03-30 18:54 ` Blue Swirl
2013-05-10 20:14 ` Igor Mitsyanko
2013-05-11  6:41   ` Stefan Weil
2013-05-11  9:01     ` Igor Mitsyanko
2013-05-11 19:51       ` Stefan Weil

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).