From patchwork Tue Nov 26 21:17:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 845621 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp460325wru; Tue, 26 Nov 2024 13:19:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVdG8Imxvf8nSFUToA/IjLaOtCAVBtfZetaIu7OAuy8vTTuv+fNErJkKumT21fweOqRK+n27Q==@linaro.org X-Google-Smtp-Source: AGHT+IHEWNqQ57PGwB3vba/j4+o7U7Nim8gI70k2zHEUx+CeBelEiuc5KyssM5PRmZTtBtXKWJz3 X-Received: by 2002:ad4:5749:0:b0:6d4:760:570c with SMTP id 6a1803df08f44-6d864db28f4mr10730556d6.45.1732655953980; Tue, 26 Nov 2024 13:19:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732655953; cv=none; d=google.com; s=arc-20240605; b=Sa0talDvzcuL5c6eDO85SBgVaXQ/ixSOGp2cY7I19vpWRusnYh3m8WYXD4h79BU9ip a7BdhYgt129WPCFhKJzNsLBsI8JqkTwz/dNDm6XgGojrhxLMak1M9XwElWKmW9XRAuyA o+Lk4dIJB3VPmKF5xeBIxci05UFXWj/PAy03W06PPHChpxsDDqK2rF0ZRV45oLK7wQF2 5MnmfUW++Eh0yJBOm3Bo4FtwN8oGmNzeaG8nqhxI27sOtM24FUysoduN+gO2nL6H2SEQ 4rsTHaYUcwpytQkez4HtY0JZpkeFms2Fxz9NNT2O+u1t7xyNRcgL1AI1ygNfGOvcRHU9 AACw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zhU83W89p+RCeB/hbc2plZMB5afwgNr/zybcZ8PE9c0=; fh=Wl5FFhkP2+p5s9Jt2/9UUpf5mrHiqOccw0kBq0/IT2c=; b=lMMxux5IxtwAjCAIvZEA5yXgtSkBvtSw3fPU3Pc0MDOeXRzlfjoSuEtizSJ3zDFuFb 837c/5Os0oAl9cVLBJ22scsS0cKTc5akvA4D/sgCK/S+wgwyIT618LS0LP2nuLvQtwkr YK40S1SZXu4OzGciKw7QRZA52afJzxjungTw6cfeGUr0U5Noge7RuM41dJeXnOQu+ZoL LwEinWwC7aNwYkPZz4DAD5dbR0ANAGlVV02tfyB5CH4YEAU/FaDIJF1vEPG/5vRBjGVI 4V/iSwzApVMh6WNu3QUei8Y2SC1XSlgVvzVaxG25UU6AaFHPv+LU88O6tZIOErhqDCBo Sw4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fvUjHhUM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d451b6c408si124822306d6.430.2024.11.26.13.19.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 13:19:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fvUjHhUM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tG2wh-0001Vr-1e; Tue, 26 Nov 2024 16:18:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tG2we-0001Uy-Dj for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:04 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tG2wc-0001aq-MZ for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:04 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-724f383c5bfso3074046b3a.1 for ; Tue, 26 Nov 2024 13:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732655881; x=1733260681; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zhU83W89p+RCeB/hbc2plZMB5afwgNr/zybcZ8PE9c0=; b=fvUjHhUMAyznJHel/DwOISGBKS/JFDnYzdmpq7m1sORcZQj2eDrIIgPFaeuOaMI5T3 WckLyYjbCYMpZs0OOo1OMR4gvtIdP/S0XFiANuYHkqaxX5y9C54eOaL4ave8CyMCgANK oIrNHkqgYiH78Jd8s5eQoAjmK8Wrcv9/SbSfZwj/SAIE3Yv96Vi4D6qu3ORea/PkL3tQ dBDuKVv1ul2Q31tCuHxRQN/ZMCUbBkuDMmp4NwvaV8R93h2PFT0ui1EdWE9P30wZwKRa y85ubiOeFU2VYncPLVxtW47EpoMXW17iixvlIMDYQ5iQ9y/X2SgORL4XXZxfRpT03ojT 8kpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732655881; x=1733260681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zhU83W89p+RCeB/hbc2plZMB5afwgNr/zybcZ8PE9c0=; b=H3okOeD3x+AM/rVXzkrR4darzCuD785t21tVMtFyPK6juHdjiWoznt3ddvmNnFTp9R gTe0XayBk0GXQde/akuZesyhONytCs1+zW+g+dgLB2hEnxG0qLVFKm3Ud4d0wNjJclHO etsq4ZeEYqMwMnPeYk8hO30QvfTunLz+CWbBTPb3SfWcubZtp6QNbEyeClbeYa8rjPHq HNtMc9Dydx9Vw0oyuxLLf/1P6UqMF5f0FrshfkW8MFQNu8Z1Uddb9qhpreAtcRohS4PV SJjHOcQOGzv/mvOyfDb0jgcsObdHmygnbwIhhOCLvL35cvbmWG9fqYDRp8KMz+lJEHGw zcPA== X-Gm-Message-State: AOJu0YxtePeQHZyTB2MzZqw3IHm66/Wx3Dy8tpsOeHDowsliKJjQOh5F 4zN5p/tW5b91ZPCg3e62B+t0PX+3jkXK03szdNpEt4S3HYtt86U90yBL8RaHQRN5nI4979yPqgt jkX0= X-Gm-Gg: ASbGncseRhEJPvQ9v8p0+50AHGIb9+ckYCpMH2QFq7pi7125dHi1uzQfyVEjelmO12M 0qWUJE6me+1zFHbXBGyJ0BBL62DkJ1Z7LwyoCwIjxotBjXXjfmcZ9u6iGitPsvG6U8mRCbUu56o WFsMCt1YaDjuH8mbqU1J2zjshdW3HeOrNOUrNx0Bycep1PJqxELQyORSL1sRJyWoCqPwZSC33Pj 6kO404EM2dTY+unKDkCNqqEAuDVCeFex4In49L4tN8I5RkwA1+ZtVBEFOArdmXvrf+mXTgxbPjl 0bM6T92eJn0nEg== X-Received: by 2002:a05:6a00:928e:b0:724:f1c7:dfbb with SMTP id d2e1a72fcca58-7253001aa22mr1020702b3a.7.1732655881402; Tue, 26 Nov 2024 13:18:01 -0800 (PST) Received: from linaro.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724fd95ed01sm5811766b3a.8.2024.11.26.13.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 13:18:00 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefano Garzarella , "Michael S. Tsirkin" , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Pierrick Bouvier , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Markus Armbruster , Mahmoud Mandour , Paolo Bonzini , Alexandre Iooss Subject: [PATCH v2 1/3] win32: remove usage of attribute gcc_struct Date: Tue, 26 Nov 2024 13:17:34 -0800 Message-Id: <20241126211736.122285-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241126211736.122285-1-pierrick.bouvier@linaro.org> References: <20241126211736.122285-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This attribute is not recognized by clang. An investigation has been performed to ensure this attribute has no effect on layout of structures we use in QEMU [1], so it's safe to remove now. In the future, we'll forbid introducing new bitfields in packed struct. [1] https://lore.kernel.org/qemu-devel/66c346de-7e20-4831-b3eb-1cda83240af9@linaro.org/ Signed-off-by: Pierrick Bouvier Reviewed-by: Thomas Huth Acked-by: Stefano Garzarella --- meson.build | 5 ----- include/qemu/compiler.h | 7 +------ scripts/cocci-macro-file.h | 6 +----- subprojects/libvhost-user/libvhost-user.h | 6 +----- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/meson.build b/meson.build index e0b880e4e13..fa6d24e1233 100644 --- a/meson.build +++ b/meson.build @@ -354,11 +354,6 @@ elif host_os == 'sunos' qemu_common_flags += '-D__EXTENSIONS__' elif host_os == 'haiku' qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE', '-fPIC'] -elif host_os == 'windows' - if not compiler.compiles('struct x { int y; } __attribute__((gcc_struct));', - args: '-Werror') - error('Your compiler does not support __attribute__((gcc_struct)) - please use GCC instead of Clang') - endif endif # Choose instruction set (currently x86-only) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index c06954ccb41..d904408e5ed 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -22,12 +22,7 @@ #define QEMU_EXTERN_C extern #endif -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) -# define QEMU_PACKED __attribute__((gcc_struct, packed)) -#else -# define QEMU_PACKED __attribute__((packed)) -#endif - +#define QEMU_PACKED __attribute__((packed)) #define QEMU_ALIGNED(X) __attribute__((aligned(X))) #ifndef glue diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h index d247a5086e9..c64831d5408 100644 --- a/scripts/cocci-macro-file.h +++ b/scripts/cocci-macro-file.h @@ -23,11 +23,7 @@ #define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #define G_GNUC_NULL_TERMINATED __attribute__((sentinel)) -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) -# define QEMU_PACKED __attribute__((gcc_struct, packed)) -#else -# define QEMU_PACKED __attribute__((packed)) -#endif +#define QEMU_PACKED __attribute__((packed)) #define cat(x,y) x ## y #define cat2(x,y) cat(x,y) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h index deb40e77b3f..2ffc58c11b1 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -186,11 +186,7 @@ typedef struct VhostUserShared { unsigned char uuid[UUID_LEN]; } VhostUserShared; -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) -# define VU_PACKED __attribute__((gcc_struct, packed)) -#else -# define VU_PACKED __attribute__((packed)) -#endif +#define VU_PACKED __attribute__((packed)) typedef struct VhostUserMsg { int request; From patchwork Tue Nov 26 21:17:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 845618 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp460242wru; Tue, 26 Nov 2024 13:18:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVehatKB83UUePAFVeKtVCDwHOjMpmHj5QdOm9Sbo8S9jguMs8q9XvotKnCt8onSHGYmJQAgQ==@linaro.org X-Google-Smtp-Source: AGHT+IFTa/+zqzrvKWJfbmPvyqe2d2YFafpX43g5spAqoE6wG1oPBEoMukoowoT9wHQ6VGxbWia1 X-Received: by 2002:a05:6122:17a5:b0:509:e80:3ed2 with SMTP id 71dfb90a1353d-51556aa8c82mr953813e0c.7.1732655938934; Tue, 26 Nov 2024 13:18:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732655938; cv=none; d=google.com; s=arc-20240605; b=cH54b9SdFY9snTYfs4AfGs3wHbamTJO7QEoREreWHRqVYIlZEKiVGIJRT92mYDSiWN MD9GX6PFPG+O948NkFJFPBLHYUNimLhOoyVShTsaQ1EBQmZH86ejMELvxqbBe9NZKtba EfBm80ujPzt0zhm09ydIzFbtOBGR70yLOjWRVC0BLgIVe7NSGqLoreaI+N3CQ8BsiKic olugOEABcEbBGGtT3x1gBzUheGxddy5mLBAxeHiynL/CEFNea3SITLNTgGe+xg+lY6tP USlCT9QZLgz0cZAjw4VWNrF87zFbToAlWPscxUTJ/ARXSWpWD++/+d+nTsx6XVeXwhFj vcjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=elyeMJQumM/ae9b99n9BARezLApCIDcQzZJOkDjnTNE=; fh=Wl5FFhkP2+p5s9Jt2/9UUpf5mrHiqOccw0kBq0/IT2c=; b=ZysjjPEHq2xvi6sydK1IfR+Ii9jrLG8lpeEuC8HAAJZ5TApR5Zl3gZxcz9oYA/iGXN mBLWRsPJLe+qy29375dT/hgPgGf/RMa2NCqKvMpspE39Im+DbpPdeyIlts2AyaowOChO Ow9Ik0hvBkxfgAh3BsA8XgVYtRw4zHuW7eoVm++WDh+N0Qjzp0qB0oUipyONY8v2rjm2 vKyS8VBzrGvX5XDBUJzs4yDOzlf6MOkUBfaDX1AP/yoR6EDZ55T7I5m0qKKDIHu7bcGP OdR73LPEpXle8xhIkrzpVNDHMVvcHPxZyPu7ax0XcDddruIp/gF717RwZg9QmQykve9S ofBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XXHjQ2jZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51544568388si1236674e0c.166.2024.11.26.13.18.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 13:18:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XXHjQ2jZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tG2wh-0001Vn-0x; Tue, 26 Nov 2024 16:18:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tG2wf-0001VD-Ek for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:05 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tG2wd-0001b1-SR for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:05 -0500 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-7fc41dab8e3so1137320a12.3 for ; Tue, 26 Nov 2024 13:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732655882; x=1733260682; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=elyeMJQumM/ae9b99n9BARezLApCIDcQzZJOkDjnTNE=; b=XXHjQ2jZtUpl1ahosr/fXlvZW8eXLI34jaSg+2V4tQ+WEakH+GQlggcLWV6H2ctdgK KVj8d8UaDaM4aCjgXeEZqSw+fjE9T+ipTdoiHCmBJmV/IFh3NbikoCZ1aqO4rxf+JDKP V3p536iRlCYolsVausdLRIMnNj746pFuqO4fWA+cpnJtAwVR0hKJDaNa2Jk2SycihW/O Xw/HNMLBdG4hv1HpQ17mThw0QdyYHSDXgCZV7zEexJym1iKm6wgki6q/3WtUtipyZ8ss lsQ0AUgzXWdj4wNA26/Z1ad/6HCzF92kC6uKQrgphSNcPVKOzUgWP4vKsZ8xyOGFeY8k S95A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732655882; x=1733260682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=elyeMJQumM/ae9b99n9BARezLApCIDcQzZJOkDjnTNE=; b=SKzmjpQMPS++j1D1CYixg9jocAQJwAgQQZz4+Ij4tOCQ8uor5p+XjD8iRBeJw3fHsA xtHQ6ikmVWMhnq09I3rKW046r0vm5e3QvbEQStgdSclnrAc/3z2ue2/50Rk6/471BdI4 RXrgxwrHbeF+sayzDGYbD4COec7eKBoAW0Ciz7eAvjWP2HKqxSn0Mc91zuTicTnv7MS7 0vzSHezSDZt9PIf0h4ZmS+cRX3/j1K/ofAoCEyNT5Qv7CbpLir+kKfBPxTyw8LE0gNfw mUILYa9KnD/uGLOu/DNNxpbumsH9L+fQSz0yIJ7V75I8/BTlxkSzvdNDwRh1lZc6KlQo r4MQ== X-Gm-Message-State: AOJu0Yzbt5ZpxJLWPWGXvFYpiDfc8xxZGDsqOu2jGIXF/ofZhm5QVmMY izUkTo/UH0AdLAuZbTwpNaE1wHtPKo4QdqA885seifKLDCSA4uhFkuswAvwQfGxrrFh6omGQ9Mm vIqo= X-Gm-Gg: ASbGnctdlO0JzPAFQoi1ZaezPjj9a3mXj/DhChLrUn5cZYZn1SQd90KIcO+OU+Dj/kV 3Lo0dqVbzvDVsE3nZbBlMlO5A2TEaMF8bvU91DEQSZc1V4r/r+Z1xk9sBp4gsw65blH6D578yka 6hjTB4PBWZ6fcaeDagA6U/Xxoz1Q4wX4Dk2qyZeRRCYXu6soky/5kA3ViMc2Y0iKfLgoy00R5n2 wmG+mtcsxPuburRqHL40p8hFS4jXO59sv6vC55FCU6Z/BbKGd8vNLBm3E8r+09AFY3rtuu5jRA5 ottXMUmPnq7K0Q== X-Received: by 2002:a05:6a20:2451:b0:1dc:bdbd:9017 with SMTP id adf61e73a8af0-1e0e0b6c85amr1532603637.40.1732655882476; Tue, 26 Nov 2024 13:18:02 -0800 (PST) Received: from linaro.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724fd95ed01sm5811766b3a.8.2024.11.26.13.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 13:18:01 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefano Garzarella , "Michael S. Tsirkin" , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Pierrick Bouvier , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Markus Armbruster , Mahmoud Mandour , Paolo Bonzini , Alexandre Iooss Subject: [PATCH v2 2/3] docs/devel/style: add a section about bitfield, and disallow them for packed structures Date: Tue, 26 Nov 2024 13:17:35 -0800 Message-Id: <20241126211736.122285-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241126211736.122285-1-pierrick.bouvier@linaro.org> References: <20241126211736.122285-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Pierrick Bouvier --- docs/devel/style.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 2f68b500798..13cb1ef626b 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -416,6 +416,16 @@ definitions instead of typedefs in headers and function prototypes; this avoids problems with duplicated typedefs and reduces the need to include headers from other headers. +Bitfields +--------- + +C bitfields can be a cause of non-portability issues, especially under windows +where `MSVC has a different way to layout them than gcc +`_. +For this reason, we disallow usage of bitfields in packed structures. +For general usage, using bitfields should be proven to add significant benefits +regarding memory usage or usability. + Reserved namespaces in C and POSIX ---------------------------------- From patchwork Tue Nov 26 21:17:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 845620 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp460265wru; Tue, 26 Nov 2024 13:19:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV+C3u6KxP7+S2wwi/pW8ZdqZGW08wcstGxqwF7PHvyWzO/sjurhoCFkDBilHYgM38WgVGXyA==@linaro.org X-Google-Smtp-Source: AGHT+IH4od/tn6ZVeyQjq/EzeHvcdw8JaOxyxpfwcmzi7bRNhwBb74cA06PnJbj5TiqycKE+iu3I X-Received: by 2002:a05:6102:4412:b0:4ad:647c:428e with SMTP id ada2fe7eead31-4af447f7f15mr1241473137.4.1732655941366; Tue, 26 Nov 2024 13:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732655941; cv=none; d=google.com; s=arc-20240605; b=BGGmgfrEsSzB/57QAt8Nx3XITuKAKtoUoYAx6cwPw5whSOD+yM+fQ6TSk6LOwOGAy8 F6+Zwm7CX2avr8h6cSsIMelm9GkxgVKyJlZkZRb8lKepFJ4mqVdHL8tWW0AiLqciz8Ks 31cLZyxZvQAJ84198jqZ2NJFe2PW1XjELkAibIeCzhflloGZCUvNq0FEX6TutiNx/PRt 2pZgjJYaBJ007PK6sZ+jEQqjG0khjvLASjY6YNPnGde6MPurvf0D4SZMJsMAd++0vN9Y ehpWrihM9qJnRgfTXsJcoUJ28XpIRFhVsB58mwL63ODmBRfQ1/oDNqNSjpJEiK3oNF4u okrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oi405Te5zlAvKGQ9MzdgLBP2VXUFNr+apC11qm7Xajc=; fh=Wl5FFhkP2+p5s9Jt2/9UUpf5mrHiqOccw0kBq0/IT2c=; b=Qbg5pdS5faQT1QrwsaN9nViIGZVpNLyl/GwS+rsYzA5YKIWUcJGeWkbo7EZ7sXQvq7 nggG2osJFzGPwlSHb67QajGFrvHMVdAgtzJYj10/Jx8b0v3QUwakOTRcmlayEN29kH15 ppqls6SU2uWv2IQZzELh0TWEveu+OQjL1VtnBOpOVsmOmDYZvdUm7FM05ZXhHsEMXGA4 g3M+sTviu9ev1Gg6nJXqhT0yghfRgSZxkUV4XZIMZyodeqQDvlNqMB0az8knXYQpn6BB e2pV1W7kq1fmys8Dod4/96KdoaWh7q0/Jsha5smlJZNBKDBUmiZVlPwSObJsFkUcV5Jm UIeQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eJPDqdin; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4af35936addsi1171309137.581.2024.11.26.13.19.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 13:19:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eJPDqdin; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tG2wi-0001WZ-JP; Tue, 26 Nov 2024 16:18:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tG2wh-0001Vx-18 for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:07 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tG2wf-0001bB-6g for qemu-devel@nongnu.org; Tue, 26 Nov 2024 16:18:06 -0500 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-7ea8c4ce232so5368286a12.0 for ; Tue, 26 Nov 2024 13:18:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732655883; x=1733260683; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oi405Te5zlAvKGQ9MzdgLBP2VXUFNr+apC11qm7Xajc=; b=eJPDqdinsyb4+b0xf9fOP2KXIcKFJrTJiPFzV7WESEo2rREVAJMaR9n6iYtD4Mvx3e Dko7S4Tmc/zwhcp0gg4FoyKg1Z+qC3L2p/HNLodN1ZBv0mCWN0s/h6VpiczSj8eXxC7e 9z66FFX1VCbtgLtFV04K+Dr7+9apltLVESFbZKXTQI2xjmW3ROu/TrQH8m5ZEq1blRo3 bsRPeVa1r/m5O/drgBHt5ClKAf7GX77p0IxtHJXkEt4tsYBdK3BmVJRNL2kPs3Ge1QGV bdGPHOVBbKTdM6qeWGDk0MOHpIKryPwsEFOXTtUd1w81ZsMwVYdk4hcYZMoJ9qWtvShM tF/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732655883; x=1733260683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oi405Te5zlAvKGQ9MzdgLBP2VXUFNr+apC11qm7Xajc=; b=iw9uJ8bPmthDaMROK5AVPQB/Tv+dtXnk5oo+TY0TpZQVIMJC93GiXuTbehbHgVgzZ3 jvVfGl1naIVV4mPtq2mctV3kCNlVhzhqcEScIYElEGSo1jXwdoMRAGVLBYG7EZ2ef//Z J5bzcE62pmiqD92PBSVoW4d8W8euu3DV+jLE8xwZujnGhE96AivLIu920kp7Au36lRBx bG0tHrfK7p7ShXkpSW8bHI0QL2ToxdocQqD4xkj50GP2kqn6UL+40wELWWZ2tptD9Uts xccXjAVvMkcYnEU6CWNpvgwZXRgHYJZb6ewbEcn/WwhUuYldoWaZLsraaXCCCNaPhP1u zAhw== X-Gm-Message-State: AOJu0YyOVMo7uDW5djUzbFQnzLNoeZjXbZEJiWWkPkT6eIZWYho+likU poQfALLKnwotr1tb6eWa0GU/bKvEh5yAcRu8PGZb0GNkVEktabmxpA8q/r2EblFQbOkga9z8Ll7 vLrw= X-Gm-Gg: ASbGnctpfucuxMgaiTE4rMN2lIpnRtUjE8GjPQm+rlZYjonUnOjCE2KKm/1KddACVh1 +3s/UMpQE0IR0HqTsP5IPdTHyL+dJn4hbhfOYXe1nYicgKYI4vlAyU3PXYG6XoCYPujCPjZH1IH 2bPTPGCIq6Xb7IBdyNjsf8VRcKOOt+2hFjmit4m4s5Zx6Jl+PUaFvVZP/mjKSOaR1O36PMy7iIA c8Rq5oc1VRfE9+EGFNcPinW2RwjjpkftmXE9f2cUi4uEV6B86UauHaBVUXJCRW+AYdSatDgMsml 82dDXhARium7KA== X-Received: by 2002:a05:6a21:3397:b0:1e0:db67:e9f9 with SMTP id adf61e73a8af0-1e0e0b120ffmr1407474637.22.1732655883559; Tue, 26 Nov 2024 13:18:03 -0800 (PST) Received: from linaro.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724fd95ed01sm5811766b3a.8.2024.11.26.13.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 13:18:03 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefano Garzarella , "Michael S. Tsirkin" , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Pierrick Bouvier , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Markus Armbruster , Mahmoud Mandour , Paolo Bonzini , Alexandre Iooss Subject: [PATCH v2 3/3] plugins: enable linking with clang/lld Date: Tue, 26 Nov 2024 13:17:36 -0800 Message-Id: <20241126211736.122285-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241126211736.122285-1-pierrick.bouvier@linaro.org> References: <20241126211736.122285-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Windows uses a special mechanism to enable plugins to work (DLL delay loading). Option for lld is different than ld. MSYS2 clang based environment use lld by default, so restricting to this config on Windows is safe, and will avoid false bug reports. Signed-off-by: Pierrick Bouvier --- meson.build | 5 +++++ contrib/plugins/meson.build | 2 +- plugins/meson.build | 24 ++++++++++++++++++++---- tests/tcg/plugins/meson.build | 3 +-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index fa6d24e1233..8ccee3f5b34 100644 --- a/meson.build +++ b/meson.build @@ -354,6 +354,11 @@ elif host_os == 'sunos' qemu_common_flags += '-D__EXTENSIONS__' elif host_os == 'haiku' qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE', '-fPIC'] +elif host_os == 'windows' + # plugins use delaylib, and clang needs to be used with lld to make it work. + if compiler.get_id() == 'clang' and compiler.get_linker_id() != 'ld.lld' + error('On windows, you need to use lld with clang - use msys2 clang64/clangarm64 env') + endif endif # Choose instruction set (currently x86-only) diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build index 63a32c2b4f0..484b9a808c8 100644 --- a/contrib/plugins/meson.build +++ b/contrib/plugins/meson.build @@ -12,7 +12,7 @@ if get_option('plugins') t += shared_module(i, files(i + '.c') + 'win32_linker.c', include_directories: '../../include/qemu', link_depends: [win32_qemu_plugin_api_lib], - link_args: ['-Lplugins', '-lqemu_plugin_api'], + link_args: win32_qemu_plugin_api_link_flags, dependencies: glib) else t += shared_module(i, files(i + '.c'), diff --git a/plugins/meson.build b/plugins/meson.build index 98542e926f8..d60be2a4d6d 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -17,14 +17,15 @@ if not enable_modules capture: true, command: ['sed', '-ne', 's/^[[:space:]]*\\(qemu_.*\\);/_\\1/p', '@INPUT@']) emulator_link_args += ['-Wl,-exported_symbols_list,plugins/qemu-plugins-ld64.symbols'] + elif host_os == 'windows' and meson.get_compiler('c').get_id() == 'clang' + # LLVM/lld does not support exporting specific symbols. However, it works + # out of the box with dllexport/dllimport attribute we set in the code. else emulator_link_args += ['-Xlinker', '--dynamic-list=' + qemu_plugin_symbols.full_path()] endif endif if host_os == 'windows' - dlltool = find_program('dlltool', required: true) - # Generate a .lib file for plugins to link against. # First, create a .def file listing all the symbols a plugin should expect to have # available in qemu @@ -33,12 +34,27 @@ if host_os == 'windows' output: 'qemu_plugin_api.def', capture: true, command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@']) + # then use dlltool to assemble a delaylib. + # The delaylib will have an "imaginary" name (qemu.exe), that is used by the + # linker file we add with plugins (win32_linker.c) to identify that we want + # to find missing symbols in current program. + win32_qemu_plugin_api_link_flags = ['-Lplugins', '-lqemu_plugin_api'] + if meson.get_compiler('c').get_id() == 'clang' + # With LLVM/lld, delaylib is specified at link time (-delayload) + dlltool = find_program('llvm-dlltool', required: true) + dlltool_cmd = [dlltool, '-d', '@INPUT@', '-l', '@OUTPUT@', '-D', 'qemu.exe'] + win32_qemu_plugin_api_link_flags += ['-Wl,-delayload=qemu.exe'] + else + # With gcc/ld, delay lib is built with a specific delay parameter. + dlltool = find_program('dlltool', required: true) + dlltool_cmd = [dlltool, '--input-def', '@INPUT@', + '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe'] + endif win32_qemu_plugin_api_lib = configure_file( input: win32_plugin_def, output: 'libqemu_plugin_api.a', - command: [dlltool, '--input-def', '@INPUT@', - '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe'] + command: dlltool_cmd ) endif specific_ss.add(files( diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build index f847849b1b7..87a17d67bd4 100644 --- a/tests/tcg/plugins/meson.build +++ b/tests/tcg/plugins/meson.build @@ -5,9 +5,8 @@ if get_option('plugins') t += shared_module(i, files(i + '.c') + '../../../contrib/plugins/win32_linker.c', include_directories: '../../../include/qemu', link_depends: [win32_qemu_plugin_api_lib], - link_args: ['-Lplugins', '-lqemu_plugin_api'], + link_args: win32_qemu_plugin_api_link_flags, dependencies: glib) - else t += shared_module(i, files(i + '.c'), include_directories: '../../../include/qemu',