From patchwork Wed Aug 15 03:17:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 177533 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 25AB72C008F for ; Wed, 15 Aug 2012 13:17:50 +1000 (EST) Received: from localhost ([::1]:41488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1U7A-0002Qg-AM for incoming@patchwork.ozlabs.org; Tue, 14 Aug 2012 23:17:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1U73-0002QN-4w for qemu-devel@nongnu.org; Tue, 14 Aug 2012 23:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1U72-00053H-68 for qemu-devel@nongnu.org; Tue, 14 Aug 2012 23:17:41 -0400 Received: from cpe-70-123-145-39.austin.res.rr.com ([70.123.145.39]:34246 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1U71-00053C-Ub for qemu-devel@nongnu.org; Tue, 14 Aug 2012 23:17:40 -0400 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id q7F3Hb28028991; Tue, 14 Aug 2012 22:17:38 -0500 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id q7F3HatV028990; Tue, 14 Aug 2012 22:17:36 -0500 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Tue, 14 Aug 2012 22:17:36 -0500 Message-Id: <1345000656-28955-1-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.5.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.145.39 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH] win32: provide separate macros for weak decls and definitions 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 mingw32 seems to want the declaration to also carry the weak attribute. Strangely, gcc on Linux absolutely does not want the declaration to be marked as weak. This may not be the right fix, but it seems to do the trick. Signed-off-by: Anthony Liguori --- arch_init.h | 4 ++++ compiler.h | 6 ++++++ qmp.c | 8 +++++++- target-i386/cpu.c | 4 ++-- target-ppc/translate_init.c | 4 ++-- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/arch_init.h b/arch_init.h index 547f93c..d9c572a 100644 --- a/arch_init.h +++ b/arch_init.h @@ -1,6 +1,8 @@ #ifndef QEMU_ARCH_INIT_H #define QEMU_ARCH_INIT_H +#include "qmp-commands.h" + enum { QEMU_ARCH_ALL = -1, QEMU_ARCH_ALPHA = 1, @@ -32,4 +34,6 @@ int tcg_available(void); int kvm_available(void); int xen_available(void); +CpuDefinitionInfoList GCC_WEAK_DECL *arch_query_cpu_definitions(Error **errp); + #endif diff --git a/compiler.h b/compiler.h index f76921e..07ba1f8 100644 --- a/compiler.h +++ b/compiler.h @@ -45,7 +45,13 @@ # define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2))) # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m))) # endif +#if defined(_WIN32) +#define GCC_WEAK __attribute__((weak)) +#define GCC_WEAK_DECL GCC_WEAK +#else #define GCC_WEAK __attribute__((weak)) +#define GCC_WEAK_DECL +#endif #else #define GCC_ATTR /**/ #define GCC_FMT_ATTR(n, m) diff --git a/qmp.c b/qmp.c index 6c1e4e8..8463922 100644 --- a/qmp.c +++ b/qmp.c @@ -468,8 +468,14 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, return prop_list; } -CpuDefinitionInfoList GCC_WEAK *qmp_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList GCC_WEAK *arch_query_cpu_definitions(Error **errp) { error_set(errp, QERR_NOT_SUPPORTED); return NULL; } + +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +{ + return arch_query_cpu_definitions(errp); +} + diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6d5d0d6..120a2e3 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -28,7 +28,7 @@ #include "qemu-config.h" #include "qapi/qapi-visit-core.h" -#include "qmp-commands.h" +#include "arch_init.h" #include "hyperv.h" @@ -1126,7 +1126,7 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf, const char *optarg) } } -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list = NULL; x86_def_t *def; diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 6fe4168..fba2b42 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -27,7 +27,7 @@ #include "gdbstub.h" #include #include "kvm_ppc.h" -#include "qmp-commands.h" +#include "arch_init.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR @@ -10346,7 +10346,7 @@ void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf) } } -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list = NULL; int i;