From patchwork Fri Jan 18 08:36:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 213523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7139E2C0087 for ; Fri, 18 Jan 2013 19:36:23 +1100 (EST) Received: from localhost ([::1]:35980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tw7Qx-0005AL-QX for incoming@patchwork.ozlabs.org; Fri, 18 Jan 2013 03:36:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tw7Qo-0005AC-Ku for qemu-devel@nongnu.org; Fri, 18 Jan 2013 03:36:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tw7Ql-0005Ff-Gp for qemu-devel@nongnu.org; Fri, 18 Jan 2013 03:36:10 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:38687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tw7Ql-0005F0-AA for qemu-devel@nongnu.org; Fri, 18 Jan 2013 03:36:07 -0500 Received: by mail-ee0-f41.google.com with SMTP id c13so1674472eek.0 for ; Fri, 18 Jan 2013 00:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=HwdtC0INUWXkJjAykw01Kj8x5hUwXSYZ+oe7qPYEjXw=; b=QgItYYDF43Qe0zHtFbocdULWHchchILTBVvNkno4NMVQ1sjNGuK2M6uxuMSa4M1Yr4 9bhsBJXfbl1yUEwYDkOqUC0J+8b/1oKK1A+lGa43uEEKPPdiQTqo+5VZghfVR/ViwkVw TtPWRoVgPZ5EaEw44pdxOYlPMrg2/FyAuTauLnogOWIJMvot+UAzWILrIUJSQsK9voCW IWWA31bxIeJpRM394g2/7xnImt3B/NG85FYr9I+M5ZotZdEF0+oWIfjnkl6vAlsnwp97 k/ypmMnejxmxpvxw/nP6NBDfEXkWZRl9mHy7m+R1HngO/OAxIe++0jLMvbj9ciQikL0+ Hc5w== X-Received: by 10.14.219.72 with SMTP id l48mr23771889eep.37.1358498166075; Fri, 18 Jan 2013 00:36:06 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id q44sm6313283eep.5.2013.01.18.00.36.04 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jan 2013 00:36:05 -0800 (PST) Message-ID: <50F90972.9030203@redhat.com> Date: Fri, 18 Jan 2013 09:36:02 +0100 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Blue Swirl References: <1358359467-16638-1-git-send-email-sw@weilnetz.de> <50F864EA.1080800@weilnetz.de> In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.83.41 Cc: Stefan Weil , Anthony Liguori , qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH] util: Fix compilation of envlist.c for MinGW X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Il 17/01/2013 22:18, Blue Swirl ha scritto: > On Thu, Jan 17, 2013 at 8:54 PM, Stefan Weil wrote: >> Am 17.01.2013 21:45, schrieb Blue Swirl: >> >>> On Wed, Jan 16, 2013 at 6:04 PM, Stefan Weil 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? (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 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();