From nobody Sun May 19 00:17:39 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1705789876658672.999319823317; Sat, 20 Jan 2024 14:31:16 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id E32271B9A; Sat, 20 Jan 2024 17:31:14 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2DE7D1A48; Sat, 20 Jan 2024 17:29:43 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id E0DD91A94; Sat, 20 Jan 2024 17:29:39 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id F1EF11A48 for ; Sat, 20 Jan 2024 17:29:37 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-63p45b6DPKmGo5US14euGQ-1; Sat, 20 Jan 2024 17:29:35 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE00D380663A for ; Sat, 20 Jan 2024 22:29:34 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56FF940C6EBA for ; Sat, 20 Jan 2024 22:29:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 63p45b6DPKmGo5US14euGQ-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [PATCH] meson: Adjust -fstack-protector use Date: Sat, 20 Jan 2024 23:29:32 +0100 Message-ID: <20240120222932.307887-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: R5C57PJM3JPTXAK5Q25DS6J3CCEUTLVA X-Message-ID-Hash: R5C57PJM3JPTXAK5Q25DS6J3CCEUTLVA X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1705789878780100001 Back in 2014, -fstack-protector was reported not to work on aarch64, so fe881ae086ec disabled it on that target. OS-wise, its use is currently limited to just Linux, FreeBSD and Windows. Looking at the situation today, it seems that whatever issue was affecting aarch64 a decade ago has been resolved; moreover, macOS can also use the feature these days. I haven't checked any of the other BSDs, but since the feature works on FreeBSD it's pretty safe to the assume that they can use it too. If we get reports that it's not the case, we can always further restrict its usage accordingly. The only platform where -fstack-protector is known to still have issues is alpha, so single that one out. Best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani --- Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/1145401848 Notice how all aarch64 jobs are fine - even the macOS ones. meson.build | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 611cc582c0..01cb49b306 100644 --- a/meson.build +++ b/meson.build @@ -442,22 +442,23 @@ supported_cc_flags =3D [] if get_option('warning_level') =3D=3D '2' supported_cc_flags =3D cc.get_supported_arguments(cc_flags) =20 - # on aarch64 error: -fstack-protector not supported for this target - if host_machine.cpu_family() !=3D 'aarch64' - if host_machine.system() in [ 'linux', 'freebsd', 'windows' ] - # we prefer -fstack-protector-strong but fallback to -fstack-protect= or-all - fstack_cflags =3D cc.first_supported_argument([ - '-fstack-protector-strong', - '-fstack-protector-all', - ]) - supported_cc_flags +=3D fstack_cflags - - # When building with mingw using -fstack-protector requires libssp l= ibrary - # which is included by using -fstack-protector with linker. - if fstack_cflags.length() =3D=3D 1 and host_machine.system() =3D=3D = 'windows' - add_project_link_arguments(fstack_cflags, language: 'c') - endif - endif + if host_machine.system() =3D=3D 'linux' and host_machine.cpu_family() = =3D=3D 'alpha' + # On alpha, gcc advertises support for -fstack-protector but then + # raises a warning when you actually try to use it + fstack_cflags =3D [] + else + # we prefer -fstack-protector-strong but fallback to -fstack-protector= -all + fstack_cflags =3D cc.first_supported_argument([ + '-fstack-protector-strong', + '-fstack-protector-all', + ]) + supported_cc_flags +=3D fstack_cflags + endif + + # When building with mingw using -fstack-protector requires libssp libra= ry + # which is included by using -fstack-protector with linker. + if fstack_cflags.length() =3D=3D 1 and host_machine.system() =3D=3D 'win= dows' + add_project_link_arguments(fstack_cflags, language: 'c') endif =20 if supported_cc_flags.contains('-Wlogical-op') --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org