From nobody Tue Jul 15 04:58:16 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650719858799483.72375209221104; Sat, 23 Apr 2022 06:17:38 -0700 (PDT) Received: from localhost ([::1]:42360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niFdp-0003Lo-Aj for importer2@patchew.org; Sat, 23 Apr 2022 09:17:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niFFs-0007Tg-5o for qemu-devel@nongnu.org; Sat, 23 Apr 2022 08:52:52 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]:44913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1niFFq-0005Cu-7j for qemu-devel@nongnu.org; Sat, 23 Apr 2022 08:52:51 -0400 Received: by mail-ed1-x52f.google.com with SMTP id el3so8641953edb.11 for ; Sat, 23 Apr 2022 05:52:49 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id bo14-20020a170906d04e00b006ce98d9c3e3sm1655573ejb.194.2022.04.23.05.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Apr 2022 05:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v/zfZz0eUCW2K/d4YbxLjJ8uZtdUIZW6uvPKbjdpjok=; b=R2+1ot9t+s+PNmuhxBcdSjHXkaKhvbbvwLDqr3OMlRDl5BdA+sGmQFRYP7RHUDLueN W5h56XZFZ6S86FhEzpGWpowdGQPVwotgPHYoc2NHnHnT//rejKREkmflPP2BwaV+jxQH DW9R2r+ZQ/3rh+mv+tdVA8xL9oQ8YaVhtXUJB/w+QPkMFiCnowBGLOXxNlL90mJaY+FW tC45mSeIjwuP/uX1sCP/lswSRj14gUT8BK5S4zvpCj0IOXeMSMawo1fkLjl+df5OZ+5J S5uLo7lir0FNcB9rVUVbThCtPGf1Z50qHvBXeBQpwCai53WEVb7sSe5Pd9KRMwLGH1AJ HYzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=v/zfZz0eUCW2K/d4YbxLjJ8uZtdUIZW6uvPKbjdpjok=; b=DDQrco/3qazzaCE+2hK+xkgMZTl4YB3XAuy4YBOWu4Qrr4gwu2QYPVfaH0YbU1ZIl5 EuERo1c3X1foPXQ3RTqOebrFUDY5GFWsWukOPOd2F6Tp3oIIxKGcoa/1fVtyRKuP7Ta4 1jT88+O3qn8g+c279RyIfUyoidgWgM71JwyLeEVYYkfl0jml9XmNwI9DjIvEkopZ2xpp TpimVLVmvVyxzdR5JmWZlDh8Z5bLlWy0fPESssifKd8/NY8XXmW7k9GAkzrpb0h1J22l cFv+CqwvcaAGTVe9MLdCuhucFdpOMi6OTTAbZegICd74Giymxd498T6+Hhi7Jtvx8qwL JeEA== X-Gm-Message-State: AOAM531E/8rgwQVXKwuBmcK/WRdIiuD/uy1TVhIsDQ4h4K4sBGFdeH/w JITAaes3miksnHMhsihbhSSA1jujJfUFZg== X-Google-Smtp-Source: ABdhPJwlwe2aEuG/54YbTRd/bl90pE9kw3xEV3w0mmaIxq/iTlMtEc4nEVENd9Pot2w4WMLt8EuHhA== X-Received: by 2002:a05:6402:26cd:b0:423:b43d:8b09 with SMTP id x13-20020a05640226cd00b00423b43d8b09mr10031868edd.400.1650718368900; Sat, 23 Apr 2022 05:52:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 25/34] meson: pass more options directly as -D Date: Sat, 23 Apr 2022 14:51:42 +0200 Message-Id: <20220423125151.27821-26-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220423125151.27821-1-pbonzini@redhat.com> References: <20220423125151.27821-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650719860614100001 If an option is not used anywhere by the configure script, it can be just added to $meson_options even if it is not parsed by the automatically generated bits in scripts/meson-buildoptions.sh. The only slightly tricky case is $debug, where the if test "$fortify_source" =3D "yes" ; then QEMU_CFLAGS=3D"-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3D2 $QEMU_CFLAGS" debug=3Dno fi assignment is dead; configure sets fortify_source=3Dno whenever debug=3Dyes. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- configure | 39 ++++++++++------------------------- meson.build | 2 +- scripts/meson-buildoptions.py | 4 ++++ scripts/meson-buildoptions.sh | 6 ++++++ 4 files changed, 22 insertions(+), 29 deletions(-) diff --git a/configure b/configure index 1640cae307..c6edbceff0 100755 --- a/configure +++ b/configure @@ -235,7 +235,6 @@ static=3D"no" cross_compile=3D"no" cross_prefix=3D"" host_cc=3D"cc" -lto=3D"false" stack_protector=3D"" safe_stack=3D"" use_containers=3D"yes" @@ -291,13 +290,10 @@ vhost_vsock=3D"$default_feature" vhost_user=3D"no" vhost_user_fs=3D"$default_feature" vhost_vdpa=3D"$default_feature" -debug_info=3D"yes" debug_tcg=3D"no" -debug=3D"no" sanitizers=3D"no" tsan=3D"no" fortify_source=3D"yes" -gcov=3D"no" EXESUF=3D"" modules=3D"no" prefix=3D"/usr/local" @@ -327,10 +323,7 @@ else fi fdt=3D"auto" =20 -# 2. Support --with/--without option -default_devices=3D"true" - -# 3. Automatically enable/disable other options +# 2. Automatically enable/disable other options tcg=3D"enabled" cfi=3D"false" =20 @@ -679,6 +672,9 @@ werror=3D"" . $source_path/scripts/meson-buildoptions.sh =20 meson_options=3D +meson_option_add() { + meson_options=3D"$meson_options $(quote_sh "$1")" +} meson_option_parse() { meson_options=3D"$meson_options $(_meson_option_parse "$@")" if test $? -eq 1; then @@ -731,9 +727,9 @@ for opt do ;; --cross-cc-*) ;; - --enable-debug-info) debug_info=3D"yes" + --enable-debug-info) meson_option_add -Ddebug=3Dtrue ;; - --disable-debug-info) debug_info=3D"no" + --disable-debug-info) meson_option_add -Ddebug=3Dfalse ;; --enable-modules) modules=3D"yes" @@ -753,9 +749,9 @@ for opt do error_exit "Can't mix --target-list-exclude with --= target-list" fi ;; - --with-default-devices) default_devices=3D"true" + --with-default-devices) meson_option_add -Ddefault_devices=3Dtrue ;; - --without-default-devices) default_devices=3D"false" + --without-default-devices) meson_option_add -Ddefault_devices=3Dfalse ;; --with-devices-*[!a-zA-Z0-9_-]*=3D*) error_exit "Passed bad --with-devic= es-FOO option" ;; @@ -771,8 +767,6 @@ for opt do ;; --without-default-features) # processed above ;; - --enable-gcov) gcov=3D"yes" - ;; --static) static=3D"yes" QEMU_PKG_CONFIG_FLAGS=3D"--static $QEMU_PKG_CONFIG_FLAGS" @@ -799,7 +793,7 @@ for opt do # Enable debugging options that aren't excessively noisy debug_tcg=3D"yes" meson_option_parse --enable-debug-mutex "" - debug=3D"yes" + meson_option_add -Doptimization=3D0 fortify_source=3D"no" ;; --enable-sanitizers) sanitizers=3D"yes" @@ -848,10 +842,6 @@ for opt do ;; --disable-werror) werror=3D"no" ;; - --enable-lto) lto=3D"true" - ;; - --disable-lto) lto=3D"false" - ;; --enable-stack-protector) stack_protector=3D"yes" ;; --disable-stack-protector) stack_protector=3D"no" @@ -862,7 +852,7 @@ for opt do ;; --enable-cfi) cfi=3D"true"; - lto=3D"true"; + meson_option_add -Db_lto=3Dtrue ;; --disable-cfi) cfi=3D"false" ;; @@ -1100,7 +1090,6 @@ Advanced options (experts only): --cpu=3DCPU Build for host CPU [$cpu] --with-coroutine=3DBACKEND coroutine backend. Supported options: ucontext, sigaltstack, windows - --enable-gcov enable test coverage analysis with gcov --enable-plugins enable plugins via shared library loading --disable-containers don't use containers for cross-building @@ -1116,7 +1105,6 @@ cat << EOF modules modules support (non-Windows) debug-tcg TCG debugging (default is disabled) debug-info debugging information - lto Enable Link-Time Optimization. safe-stack SafeStack Stack Smash Protection. Depends on clang/llvm >=3D 3.7 and requires coroutine backend ucont= ext. vhost-net vhost-net kernel acceleration support @@ -1937,7 +1925,6 @@ write_c_skeleton =20 if test "$fortify_source" =3D "yes" ; then QEMU_CFLAGS=3D"-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3D2 $QEMU_CFLAGS" - debug=3Dno fi =20 case "$ARCH" in @@ -2365,15 +2352,11 @@ if test "$skip_meson" =3D no; then NINJA=3D$ninja $meson setup \ --prefix "$prefix" \ --bindir "$bindir" \ - -Ddefault_devices=3D$default_devices \ -Dqemu_suffix=3D"$qemu_suffix" \ -Dsmbd=3D"$smbd" \ - -Doptimization=3D$(if test "$debug" =3D yes; then echo 0; else ech= o 2; fi) \ - -Ddebug=3D$(if test "$debug_info" =3D yes; then echo true; else ec= ho false; fi) \ -Dwerror=3D$(if test "$werror" =3D yes; then echo true; else echo = false; fi) \ -Db_pie=3D$(if test "$pie" =3D yes; then echo true; else echo fals= e; fi) \ - -Db_coverage=3D$(if test "$gcov" =3D yes; then echo true; else ech= o false; fi) \ - -Db_lto=3D$lto -Dcfi=3D$cfi -Dtcg=3D$tcg \ + -Dcfi=3D$cfi -Dtcg=3D$tcg \ -Dcapstone=3D$capstone -Dfdt=3D$fdt -Dslirp=3D$slirp \ $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=3D= $LIB_FUZZING_ENGINE") \ $(if test "$default_feature" =3D no; then echo "-Dauto_features=3D= disabled"; fi) \ diff --git a/meson.build b/meson.build index cdbdb1ef8b..1fa4cc255e 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('qemu', ['c'], meson_version: '>=3D0.59.3', default_options: ['warning_level=3D1', 'c_std=3Dgnu11', 'cpp_std= =3Dgnu++11', 'b_colorout=3Dauto', - 'b_staticpic=3Dfalse', 'stdsplit=3Dfalse'], + 'b_staticpic=3Dfalse', 'stdsplit=3Dfalse', 'opti= mization=3D2'], version: files('VERSION')) =20 add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: = true) diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py index 45cda8cd84..e624c16b01 100755 --- a/scripts/meson-buildoptions.py +++ b/scripts/meson-buildoptions.py @@ -33,6 +33,8 @@ } =20 OPTION_NAMES =3D { + "b_coverage": "gcov", + "b_lto": "lto", "malloc": "enable-malloc", "pkgversion": "with-pkgversion", "qemu_firmwarepath": "firmwarepath", @@ -41,6 +43,8 @@ } =20 BUILTIN_OPTIONS =3D { + "b_coverage", + "b_lto", "datadir", "includedir", "libdir", diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index a52cc14d13..274639777e 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -27,7 +27,9 @@ meson_options_help() { printf "%s\n" ' --enable-fdt[=3DCHOICE] Whether and how to find the = libfdt library' printf "%s\n" ' (choices: auto/disabled/enable= d/internal/system)' printf "%s\n" ' --enable-fuzzing build fuzzing targets' + printf "%s\n" ' --enable-gcov Enable coverage tracking.' printf "%s\n" ' --enable-gprof QEMU profiling with gprof' + printf "%s\n" ' --enable-lto Use link time optimization' printf "%s\n" ' --enable-malloc=3DCHOICE choose memory allocator to u= se [system] (choices:' printf "%s\n" ' jemalloc/system/tcmalloc)' printf "%s\n" ' --enable-module-upgrades try to load modules from alter= nate paths for' @@ -182,6 +184,10 @@ _meson_option_parse() { --disable-avx2) printf "%s" -Davx2=3Ddisabled ;; --enable-avx512f) printf "%s" -Davx512f=3Denabled ;; --disable-avx512f) printf "%s" -Davx512f=3Ddisabled ;; + --enable-gcov) printf "%s" -Db_coverage=3Dtrue ;; + --disable-gcov) printf "%s" -Db_coverage=3Dfalse ;; + --enable-lto) printf "%s" -Db_lto=3Dtrue ;; + --disable-lto) printf "%s" -Db_lto=3Dfalse ;; --block-drv-ro-whitelist=3D*) quote_sh "-Dblock_drv_ro_whitelist=3D$2"= ;; --block-drv-rw-whitelist=3D*) quote_sh "-Dblock_drv_rw_whitelist=3D$2"= ;; --enable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whiteli= st_in_tools=3Dtrue ;; --=20 2.35.1