From nobody Sat Apr 11 23:07:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=yodel.dev ARC-Seal: i=1; a=rsa-sha256; t=1772500899; cv=none; d=zohomail.com; s=zohoarc; b=lcvqShT8RBI97ereRZ9oEuyG6C0fgFpY8ffMcAwsE0AwuJgeF/kQGHH/TvfG6PVfZArzmwI6/HMOOF6mD5XF36k5y3CQ7ni7QdMLmHyB4TEXbdoeeEd/hz0EBFFvYmyb80dl/DiMPZmnWkEqPIs4BIc7DXi1sLEGwNG/95TmWsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772500899; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SMJ2+uZ9t8KOONtPyquvJBHu8/97x1OkjUugrAbHHsU=; b=Lr10JgFkSSVPlmnnwhOxK2eRIfI+E4cMkV/Mhl2kAK+0olT6FEH2IPKaKGUCxCf44rPDcth8z3we/QC13EAtT9N3Q76eP0Ll/MpjRojcVqyWWw3LGn5Fz2Wj2Ieudt0JI8Rg3hqCpW1VmYN8xtP4MPGhnQjqejLR5kZCEbKLNPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772500899914904.9980653381592; Mon, 2 Mar 2026 17:21:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxERu-0000bb-74; Mon, 02 Mar 2026 20:21:22 -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 1vxERn-0000ay-TS for qemu-devel@nongnu.org; Mon, 02 Mar 2026 20:21:15 -0500 Received: from v512.v5f06b487.use4.send.mailgun.net ([143.55.232.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vxERm-0000bq-9N for qemu-devel@nongnu.org; Mon, 02 Mar 2026 20:21:15 -0500 Received: from mail.yodel.dev (mail.yodel.dev [35.209.39.246]) by 4858bf436de4266e41ad2c63a793c532f320b885a159d9bda3ce41d08056f6e0 with SMTP id 69a63787a460b99e998d8677; Tue, 03 Mar 2026 01:21:11 GMT X-Mailgun-Sid: WyI4ZDFlNiIsInFlbXUtZGV2ZWxAbm9uZ251Lm9yZyIsIjk3NjA3ZSJd X-Mailgun-Sending-Ip: 143.55.232.12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yodel.dev; s=rsa2048; t=1772500870; bh=SMJ2+uZ9t8KOONtPyquvJBHu8/97x1OkjUugrAbHHsU=; h=X-Mailgun-Dkim:From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From:Reply-to:Subject:Date:Message-id:To: Cc:Mime-version:Content-type:Content-transfer-encoding:In-reply-to: References; b=fJxq+BKHCgAIMBHr9G31PSk7R+ghkyyoExSw7sqsYY/DatDoLvNd8BtbJJ7LrpAqh ugqWtBNDESxZ+bDBTEhl7L8qSWYp0XoKB3/NndZV6brlCaQSjnzsGhgGG2JSuA8FLT 0f/WkcY3QjzSRzcARqUgHsaMJmjUov7KoTRo3tS9FEjcSOxshG0k97OxnjbqTDPRk6 RmcYN+/D4ptTrx0cKQqhBnhvpfkWLtbuUPgLQJ8Qru16mFJZWF9jHIazfu2LfQPoXc 6jlDFcL2RBR1bM5b1rkCqss3cF/4+rYZ8fRWf+MID7h15Mh7AWASvytW25ydglvj/S iq4aDe5zlpB8w== X-Mailgun-Dkim: no X-Mailgun-Dkim: no From: "Yodel Eldar" To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Yodel Eldar , Peter Maydell Subject: [RFC PATCH v2] configure: Use clang for sanitizer builds or disable Werror Date: Mon, 2 Mar 2026 19:20:54 -0600 Message-ID: <20260303012054.484837-1-yodel.eldar@yodel.dev> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=143.55.232.12; envelope-from=bounce+0e9322.97607e-qemu-devel=nongnu.org@yodel.dev; helo=v512.v5f06b487.use4.send.mailgun.net X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, HELO_STATIC_HOST=-0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.968, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.495, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yodel.dev) X-ZM-MESSAGEID: 1772500901894139103 Content-Type: text/plain; charset="utf-8" From: Yodel Eldar Builds with --enable-{asan,tsan,safe-stack} fail under GCC, so use clang if available, otherwise disable the treatment of warnings as errors. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3006 Suggested-by: Peter Maydell Signed-off-by: Yodel Eldar --- Hi, The previous version only disabled Werror whenever `--skip-meson` wasn't used and the build occurred in a git repo, but this change should probably apply to all types of builds. So, let's use meson_option_add to globally disable Werror instead; IIUC (and according to my testing), this will override the value in config-meson.cross.new. I'm still not sure if we should be disabling Werror for ubsan, even though it's not currently breaking builds with GCC; please let me know what you think. Special thanks to Peter for looking into the cause of the reports around this, for sharing the findings, and suggesting approaches to resolve it. I couldn't pick one over the other, so I went with using clang when available with Werror disable as a fallback; please let me know if you think this is an XOR kind of policy decision. Link to RFCv1: https://lore.kernel.org/qemu-devel/20260302210039.261325-1-yodel.eldar@yode= l.dev/ Link to mentioned discussion: https://lore.kernel.org/qemu-devel/CAFEAcA88hc4UsgpuPXBWpbeN0tW26159kPn7jx2= J9erBA5DLBw@mail.gmail.com/ v2: - Fix misnomer in commit message - Simplify condition by using the same variable for all sanitizers - Use meson_option_add to disable Werror Thanks, Yodel --- configure | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/configure b/configure index 5e114acea2..e457e8a17d 100755 --- a/configure +++ b/configure @@ -762,6 +762,12 @@ for opt do ;; --wasm64-32bit-address-limit) ;; + --enable-asan) use_sanitizer=3D"yes" + ;; + --enable-tsan) use_sanitizer=3D"yes" + ;; + --enable-safe-stack) use_sanitizer=3D"yes" + ;; # everything else has the same name in configure and meson --*) meson_option_parse "$opt" "$optarg" ;; @@ -771,6 +777,18 @@ for opt do esac done =20 +if test "$use_sanitizer" =3D "yes"; then + if has clang; then + echo "Sanitizer requested: setting compiler suite to clang" + cc=3Dclang + cxx=3Dclang++ + host_cc=3Dclang + else + echo "Sanitizer requested: disabling Werror for non-clang compiler= s" + meson_option_add -Dwerror=3Dfalse + fi +fi + if ! test -e "$source_path/.git" then git_submodules_action=3D"validate" --=20 2.53.0