From nobody Thu Dec 26 13:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693822428; cv=none; d=zohomail.com; s=zohoarc; b=k0nWzeugzl3msBou8LxQI+YRr+qDrLHtjQ9e2282DjtRz4KCeKMYOd0E7IITNAi2cptV/jSAJCTYKESoF3Kx1tpPT6+PIn9UpAmZfvnGKSqrdLk/KbVoKiXKiqQvtWTez9jBvu1oFiQVWNC3a8FXRAyH1xLWA0lE0vQxL+Ddtdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693822428; h=Content-Type:Content-Transfer-Encoding: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=k09kA5nLZzMsw1obHJwrYzDUdqowbXjwbpu8IFqxOac=; b=aPObH7Gk0uP3PXKbAjtx/B7sL/QmX4Yx/oxxKBoQyi/Os/k70ryJUtm+nIycKmQjgGVpKoMrk5uQijUUBKCsxlA6NTa8kBncs/aSwMqQ2MSs3g6NBjOWiX4mVCIhmA8YZodg8L4ON6YFHqCsCeLXomhYcXTgW6GMBrBhHeoOCTk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693822428527991.9773017345794; Mon, 4 Sep 2023 03:13:48 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-93xYquzoMTewLlo3-8UxPA-1; Mon, 04 Sep 2023 06:13:45 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95E0F38035A7; Mon, 4 Sep 2023 10:13:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2378F140E96B; Mon, 4 Sep 2023 10:13:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A50FE194729B; Mon, 4 Sep 2023 10:13:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E040E1946595 for ; Mon, 4 Sep 2023 10:13:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C37564043CCD; Mon, 4 Sep 2023 10:13:39 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47FC940C206F for ; Mon, 4 Sep 2023 10:13:39 +0000 (UTC) X-MC-Unique: 93xYquzoMTewLlo3-8UxPA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] docs: compiling: Add a note about use of CFLAGS for optimization Date: Mon, 4 Sep 2023 12:13:36 +0200 Message-ID: <40b9fbbe6045a05159c74302a07b25ab01e8c1e6.1693822354.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1693822429016100001 Content-Type: text/plain; charset="utf-8" Meson doesn't interpret what's set in CFLAGS, but rather simply appeds it to the command line. Thus any logic which is based on the optimization level will not work. Note the caveat in the docs and instruct users to use ``--optimization=3DN`` instead. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/compiling.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/compiling.rst b/docs/compiling.rst index 800264d2f9..0a47a50569 100644 --- a/docs/compiling.rst +++ b/docs/compiling.rst @@ -112,6 +112,11 @@ Please ensure that you have the appropriate minimal ``= meson`` version installed in your build environment. The minimal version for a specific package can = be checked in the top level ``meson.build`` file in the ``meson_version`` fie= ld. +**DO NOT** use the ``CFLAGS`` environment variable to set optimizations +(e.g. ``CFLAGS=3D-O0``), but rather use Meson's ``--optimization=3D0`` opt= ion. +Certain internal build options are based on the configured optimization va= lue +and Meson does not interpret ``CFLAGS``. + Compiling the sources --------------------- --=20 2.41.0 From nobody Thu Dec 26 13:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693822430; cv=none; d=zohomail.com; s=zohoarc; b=OTgCHUjkA5Tv7LxpppOvC0KsrK2KqafJClkt21iWk/Wk2TuOp21gzTWrV/0ltqS5oTDjXTRN/DuOA/A+rvKRbH0w2AZ9ytuFULMroHCL/Xw/cfFFLjOVVLtxkkcB91c35fOEzSya6Z67JptdCcZR6UxeH+z+H4BPWH+06Qd0Zjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693822430; h=Content-Type:Content-Transfer-Encoding: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=nijQYlUudLyjhipGNqFG4VTpmSfmZuTA+YDiizKTlIk=; b=Jv6EvJfVqtQDGcZz49UJt2QelimSlKodCw8syho7TPz4ZwLDAYfzfxlct3S+Zsn7Lo/Gxbr/KmIX1g+WyfpOf+CjH/qfzGSfp4tmxS/EsUkkOSh0YnuBJ8aKnI2aqhpoXF2eyRoHdmjJtVh1uZxU1NvLMUHsqaIJJcUcy2p1ofI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693822430262637.8456359599729; Mon, 4 Sep 2023 03:13:50 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-P72pc2SYMN-QSmpTLsk9tw-1; Mon, 04 Sep 2023 06:13:46 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE3311C04327; Mon, 4 Sep 2023 10:13:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6C7F493114; Mon, 4 Sep 2023 10:13:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DB77019465B7; Mon, 4 Sep 2023 10:13:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C87F619472AB for ; Mon, 4 Sep 2023 10:13:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 990924043CCD; Mon, 4 Sep 2023 10:13:40 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2395A40C206F for ; Mon, 4 Sep 2023 10:13:39 +0000 (UTC) X-MC-Unique: P72pc2SYMN-QSmpTLsk9tw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] build: Work around clang's stack size calculation without optimization Date: Mon, 4 Sep 2023 12:13:37 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1693822431085100005 Content-Type: text/plain; charset="utf-8" When building without optimization on clang, certain big functions trip the stack size limit despite not actually reaching it. Relax the stack limit size for clang without optimization. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- meson.build | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6b6f7ccb7c..d29761bc71 100644 --- a/meson.build +++ b/meson.build @@ -247,8 +247,17 @@ alloc_max =3D run_command( check: true, ) +stack_frame_size =3D 2048 + +# clang without optimization enlarges stack frames in certain corner cases +if cc.get_id() =3D=3D 'clang' and get_option('optimization') =3D=3D '0' + stack_frame_size =3D 4096 +endif + # sanitizer instrumentation may enlarge stack frames -stack_frame_size =3D get_option('b_sanitize') =3D=3D 'none' ? 2048 : 32768 +if get_option('b_sanitize') =3D=3D 'none' + stack_frame_size =3D=3D 32768 +endif # array_bounds=3D2 check triggers false positive on some GCC # versions when using sanitizers. Seen on Fedora 34 with --=20 2.41.0