From nobody Tue Feb 10 12:59:01 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683798855; cv=none; d=zohomail.com; s=zohoarc; b=MrOzfrCTva3We7mapfT9PkNcr79shQr7ePdfxFv3TW+kpEUfBy1GM9INmbDdKgMHlvBzBrI8bRZtI2ohPItdGATAliAO0mILvAm1RKrEIWjj5/MrkvPi2aCXlkqRpCmesB0EOAnuXbvoe1Xrx1gGxWC16+ZugeAKx8CKBkZokds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683798855; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=69UVRUiPqd+Rk+DhWRXTd2rrwcy2J810z1WVvGku/p0=; b=XhYKzlm73IOg1+K9Et2MNriqkGA7UX5ZSr1lWOZIaub69sV83jGjqie0TQCvcw6us7hh8/C2cjQW0jmC70ZGx9spnauAiCoclT1gLoSJzujfQWSJ3IweWoLdr2RqV66CHK8vSIFxM/R/QoamzpVveR7BMOJmhWqLCV+a9VA4oqc= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683798855559949.5593884261389; Thu, 11 May 2023 02:54:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px2wt-0000RB-Sh; Thu, 11 May 2023 05:50:59 -0400 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 1px2wp-0000Nu-Iz for qemu-devel@nongnu.org; Thu, 11 May 2023 05:50:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px2wn-0006hR-Th for qemu-devel@nongnu.org; Thu, 11 May 2023 05:50:55 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-568-5h9nEcxwNSOMv20E1kc5Cg-1; Thu, 11 May 2023 05:50:51 -0400 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-50bc88edf7eso7986906a12.2 for ; Thu, 11 May 2023 02:50:51 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id d14-20020a50fb0e000000b0050bc6d0e880sm2676683edq.61.2023.05.11.02.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 02:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683798653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=69UVRUiPqd+Rk+DhWRXTd2rrwcy2J810z1WVvGku/p0=; b=TYag/K7R3SUhJc0i5F9Wn1m/TCmux0jYy6V+V3QVC2mxELZX1yr3ksYMqun96qgxb3HCba T1/2PUJ2yRUM2q4wr8lPdPsMH+CyxSh4w/uXIikG1RLm5ZZ6l3nCVVHBkb1wlY4puulYAe jzRk28tux0csGHG7CblWmMN9/rG/Lvk= X-MC-Unique: 5h9nEcxwNSOMv20E1kc5Cg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683798649; x=1686390649; 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=69UVRUiPqd+Rk+DhWRXTd2rrwcy2J810z1WVvGku/p0=; b=dlUtgSvy7GzmXsUIugZG1g+35+cU1yiYGf0UE5+usyFNVGpx4LQ1bll9yjb4bV7MrJ zhh5cip5z9V9FADLxHvI5ol/kL/4Sp18Rex1nd5nwd1MzC4CnxehDOcZWr7uRyva23A3 /4CNRFuyGCYonahTcZzkmMuXqm0xz+OVkMqKlTxF5i27DQzHzPb47hjoGuAb7cRNgsGH gZGBu18I0v0f6tHoLF0JcDyWdyDe9pYcWyZkcOZAVXC+nWK/kuIZXc79jbobbUyaJHhC AiK09IipOmEaoW5Ey6mZHuD1izNasvyQkKuOWiPgwQMsaFGs2IKW/xLVPNPlLRo5Vl5L pjFA== X-Gm-Message-State: AC+VfDwKSk3pwwHoP+3hS+EdfojYzlwHsRTrmk5u+jjbey58rSPmcDI7 FjGerd+/BLnuOzknYVnmYk0pHJfarnCemoiwVkC6XdbBW5qgNL9yc4pW7lA8tauKz3hpb9fLj+h DCJ6Lr4GqtgHdtau0tyO2Mfx8cPDxTgoU3AlIIwVG6wO407y9rJLQ1PIiBXE5kgiV+fVQPIZPtL Q= X-Received: by 2002:a05:6402:203:b0:50b:e015:71c3 with SMTP id t3-20020a056402020300b0050be01571c3mr16621999edv.25.1683798649660; Thu, 11 May 2023 02:50:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yIRyufz8zgtsgm5HuhUs5e65YKvv7FxxqnvhFGIe1VeZnTBHwy7ohzd1s9yZY8vtvDqmtRQ== X-Received: by 2002:a05:6402:203:b0:50b:e015:71c3 with SMTP id t3-20020a056402020300b0050be01571c3mr16621986edv.25.1683798649272; Thu, 11 May 2023 02:50:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 10/24] meson: prepare move of QEMU_CFLAGS to meson Date: Thu, 11 May 2023 11:50:07 +0200 Message-Id: <20230511095021.1397802-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230511095021.1397802-1-pbonzini@redhat.com> References: <20230511095021.1397802-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683798856112100005 Clean up the handling of compiler flags in meson.build, splitting the general flags that should be included in subprojects as well, from warning flags that only apply to QEMU itself. The two were mixed in both configure tests and meson tests. This split makes it easier to move the compiler tests piecewise from configure to Meson. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- meson.build | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/meson.build b/meson.build index 7e8b29a8fc0b..e194862e7e16 100644 --- a/meson.build +++ b/meson.build @@ -190,10 +190,23 @@ endif # Compiler flags # ################## =20 -qemu_cflags =3D config_host['QEMU_CFLAGS'].split() +qemu_common_flags =3D [] +qemu_cflags =3D [] +foreach arg : config_host['QEMU_CFLAGS'].split() + if arg.startswith('-W') + qemu_cflags +=3D arg + else + qemu_common_flags +=3D arg + endif +endforeach qemu_objcflags =3D config_host['QEMU_OBJCFLAGS'].split() qemu_ldflags =3D config_host['QEMU_LDFLAGS'].split() =20 +if get_option('gprof') + qemu_common_flags +=3D ['-p'] + qemu_ldflags +=3D ['-p'] +endif + if get_option('prefer_static') qemu_ldflags +=3D get_option('b_pie') ? '-static-pie' : '-static' endif @@ -207,10 +220,9 @@ if targetos =3D=3D 'windows' qemu_ldflags +=3D cc.get_supported_link_arguments('-Wl,--dynamicbase', '= -Wl,--high-entropy-va') endif =20 -if get_option('gprof') - qemu_cflags +=3D ['-p'] - qemu_objcflags +=3D ['-p'] - qemu_ldflags +=3D ['-p'] +# Exclude --warn-common with TSan to suppress warnings from the TSan libra= ries. +if targetos !=3D 'sunos' and not config_host.has_key('CONFIG_TSAN') + qemu_ldflags +=3D cc.get_supported_link_arguments('-Wl,--warn-common') endif =20 # Specify linker-script with add_project_link_arguments so that it is not = placed @@ -226,8 +238,7 @@ if get_option('fuzzing') name: '-fsanitize-coverage-allowlist=3D/dev/null', args: ['-fsanitize-coverage-allowlist=3D/dev/null', '-fsanitize-coverage=3Dtrace-pc'] ) - add_global_arguments('-fsanitize-coverage-allowlist=3Dinstrumentation-= filter', - native: false, language: all_languages) + qemu_common_flags +=3D ['-fsanitize-coverage-allowlist=3Dinstrumentati= on-filter'] endif =20 if get_option('fuzzing_engine') =3D=3D '' @@ -235,10 +246,8 @@ if get_option('fuzzing') # compiled code. To build non-fuzzer binaries with --enable-fuzzing, = link # everything with fsanitize=3Dfuzzer-no-link. Otherwise, the linker wi= ll be # unable to bind the fuzzer-related callbacks added by instrumentation. - add_global_arguments('-fsanitize=3Dfuzzer-no-link', - native: false, language: all_languages) - add_global_link_arguments('-fsanitize=3Dfuzzer-no-link', - native: false, language: all_languages) + qemu_common_flags +=3D ['-fsanitize=3Dfuzzer-no-link'] + qemu_ldflags +=3D ['-fsanitize=3Dfuzzer-no-link'] # For the actual fuzzer binaries, we need to link against the libfuzzer # library. They need to be configurable, to support OSS-Fuzz fuzz_exe_ldflags =3D ['-fsanitize=3Dfuzzer'] @@ -249,6 +258,9 @@ if get_option('fuzzing') endif endif =20 +add_global_arguments(qemu_common_flags, native: false, language: all_langu= ages) +add_global_link_arguments(qemu_ldflags, native: false, language: all_langu= ages) + # Check that the C++ compiler exists and works with the C compiler. link_language =3D 'c' linker =3D cc @@ -272,16 +284,9 @@ if 'cpp' in all_languages endif endif =20 -# Exclude --warn-common with TSan to suppress warnings from the TSan libra= ries. -if targetos !=3D 'sunos' and not config_host.has_key('CONFIG_TSAN') - qemu_ldflags +=3D linker.get_supported_link_arguments('-Wl,--warn-common= ') -endif - -add_global_link_arguments(qemu_ldflags, native: false, language: all_langu= ages) - -add_global_arguments(qemu_cflags, native: false, language: 'c') -add_global_arguments(qemu_cxxflags, native: false, language: 'cpp') -add_global_arguments(qemu_objcflags, native: false, language: 'objc') +add_project_arguments(qemu_cflags, native: false, language: 'c') +add_project_arguments(qemu_cxxflags, native: false, language: 'cpp') +add_project_arguments(qemu_objcflags, native: false, language: 'objc') if targetos =3D=3D 'linux' add_project_arguments('-isystem', meson.current_source_dir() / 'linux-he= aders', '-isystem', 'linux-headers', @@ -3841,12 +3846,12 @@ link_args =3D get_option(link_language + '_link_arg= s') if link_args.length() > 0 summary_info +=3D {'LDFLAGS': ' '.join(link_args)} endif -summary_info +=3D {'QEMU_CFLAGS': ' '.join(qemu_cflags)} +summary_info +=3D {'QEMU_CFLAGS': ' '.join(qemu_common_flags + qemu_= cflags)} if 'cpp' in all_languages - summary_info +=3D {'QEMU_CXXFLAGS': ' '.join(qemu_cxxflags)} + summary_info +=3D {'QEMU_CXXFLAGS': ' '.join(qemu_common_flags + qem= u_cxxflags)} endif if 'objc' in all_languages - summary_info +=3D {'QEMU_OBJCFLAGS': ' '.join(qemu_objcflags)} + summary_info +=3D {'QEMU_OBJCFLAGS': ' '.join(qemu_common_flags + qem= u_objcflags)} endif summary_info +=3D {'QEMU_LDFLAGS': ' '.join(qemu_ldflags)} summary_info +=3D {'profiler': get_option('profiler')} --=20 2.40.1