qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Stefan Weil <sw@weilnetz.de>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] util: Fix compilation of envlist.c for MinGW
Date: Fri, 18 Jan 2013 09:36:02 +0100	[thread overview]
Message-ID: <50F90972.9030203@redhat.com> (raw)
In-Reply-To: <CAAu8pHtUk+bWtQtva2g1g6wSpQNREsXURTF5s22zdf0_vXtOQA@mail.gmail.com>

Il 17/01/2013 22:18, Blue Swirl ha scritto:
> On Thu, Jan 17, 2013 at 8:54 PM, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 17.01.2013 21:45, schrieb Blue Swirl:
>>
>>> On Wed, Jan 16, 2013 at 6:04 PM, Stefan Weil<sw@weilnetz.de>  wrote:
>>>>
>>>> MinGW has no strtok_r, so we need a declaration in sysemu/os-win32.h.
>>>> We must also fix the include statements in util/envlist.c to include
>>>> that file.
>>>>
>>>> We currently don't need an implementation of strtok_r because the
>>>> code is compiled but not linked for MinGW.
>>>
>>>
>>> I think it would be better to fix the build system so that unnecessary
>>> files are not compiled.
>>
>>
>> That's what I suggested first, but keeping things simple is also
>> a good argument. Perhaps we should accept that libqemuutil.a
>> can contain some unnecessary files (that's the status quo!).
> 
> This could be related. I get build errors on OpenBSD:
>   LINK  i386-bsd-user/qemu-i386
> ../libqemuutil.a(oslib-posix.o)(.text+0x540): In function `qemu_vmalloc':
> /src/qemu/util/oslib-posix.c:112: multiple definition of `qemu_vmalloc'
> bsd-user/mmap.o(.text+0x400):/src/qemu/bsd-user/mmap.c:78: first defined here
> /usr/bin/ld: Warning: size of symbol `qemu_vmalloc' changed from 260
> in bsd-user/mmap.o to 124 in ../libqemuutil.a(oslib-posix.o)

Does this fix it?

diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 5d6cffc..1f4d4a3 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -74,7 +74,7 @@ void mmap_unlock(void)
 }
 #endif

-void *qemu_vmalloc(size_t size)
+static void *qemu_vmalloc(size_t size)
 {
     void *p;
     mmap_lock();

(A better change is of course to also rename qemu_vmalloc).

>>
>> We also get the additional benefit of more portable code.
>> Even if that portability is not needed for the moment,
>> it might be useful later.
> 
> Yes, though building as an example KVM code on Win32 may be useful one
> day, that day may be distant.

That's not the kind of extra code that Stefan is talking about.  It's
extra data structures (envlist.c) that are placed in a static library
but do not appear in any final build product.

Instead, "building KVM code on Win32" is in fact something we have been
doing for years, see kvm-stub.c.

Paolo

  reply	other threads:[~2013-01-18  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 18:04 [Qemu-devel] [PATCH] util: Fix compilation of envlist.c for MinGW Stefan Weil
2013-01-17 20:45 ` Blue Swirl
2013-01-17 20:54   ` Stefan Weil
2013-01-17 21:18     ` Blue Swirl
2013-01-18  8:36       ` Paolo Bonzini [this message]
2013-01-19  8:59         ` Blue Swirl
2013-02-03 16:15 ` Blue Swirl

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=50F90972.9030203@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).