From nobody Tue Feb 10 00:00:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1679411812; cv=none; d=zohomail.com; s=zohoarc; b=W3dPIjRuNw7fRshKMlTiOq5tLUBIilmnemOBwRSY7LeHySL3s47+uaynmMEK5a9ufwGnZ42o6oFDEMdjj7lU3HZbJXNzl+ksYNat/oxyx+x4eu5QGT688lJF2gjYwuZayknZin+qV/MHp3MsbTgu+c50yTG/nzufxLbiDvfiAQw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679411812; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=RWXcokuvwHgxWxXcQgm6HWt9JaSTbt8YESVzCNNnVS0=; b=aptvCXfXnvvDr6OXxhB7yH7moIkleg9A7I1WNTAUnFYK49SWCtCpYx6lKtigLDUagkr7TItml/HuALjLtGp6E5ZiUJ2F6dXG0rV6xoChbfjAEBOxpVg1BDOLmdsxjbhKUeW4zWlr1+fe+TvNXb82m5elMnYX/Qk74nVlM11p4KI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1679411812258812.2400491110492; Tue, 21 Mar 2023 08:16:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-665-IeuxwAQ_OGuAVtGpWXXqxQ-1; Tue, 21 Mar 2023 11:13:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 865B93813F3A; Tue, 21 Mar 2023 15:11:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FFBD18EC6; Tue, 21 Mar 2023 15:11:37 +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 EC4C119465A2; Tue, 21 Mar 2023 15:11:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B577C1946594 for ; Tue, 21 Mar 2023 15:11:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 980D6463E05; Tue, 21 Mar 2023 15:11:36 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E1FA4619F5 for ; Tue, 21 Mar 2023 15:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679411805; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RWXcokuvwHgxWxXcQgm6HWt9JaSTbt8YESVzCNNnVS0=; b=Un+pPSdKkIaZrm31mfGAkZJpP6kOoibRezI1uJ+xn6B9sKOx5gpHsorGYxRZvZWIZfc86D RuUYHz7GJRLxm1JFMGayBHO7XfOnm/2X9040w4XUUg2BvvKR8vgP1Tj/Bjh5IrdAlc2Oe8 ZNKyz+5+lmOF2g742Of87+sta/dJfp0= X-MC-Unique: IeuxwAQ_OGuAVtGpWXXqxQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] meson: Disable optimizations if CLang doesn't support -fsemantic-interposition Date: Tue, 21 Mar 2023 16:11:33 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679411812977100001 Content-Type: text/plain; charset="utf-8"; x-default="true" For some older CLang (or in combination with !intel arch) the -fsemantic-interposition might be not present. But in that case, we still want our mocking in test suite to work properly. Disable optimizations as that seems to be the only way. Also, don't forget to drop this when FreeBSD 11 and macOS 12 are dropped. Signed-off-by: Michal Privoznik --- This still doesn't work when somebody overrides CFLAGS as those are placed AFTER our supported_cc_flags: $ export CFLAGS=3D"-O2 -ggdb" $ meson setup _build $ ninja -v -C _build/ [1/1202] clang ... -O2 -g ... -O0 -O2 -ggdb -fPIC ... -c ../src/util/glib= compat.c meson.build | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meson.build b/meson.build index a0682e8d0b..249505d474 100644 --- a/meson.build +++ b/meson.build @@ -492,6 +492,13 @@ if get_option('warning_level') =3D=3D '2' endif =20 endif + +if cc.get_id() =3D=3D 'clang' and not supported_cc_flags.contains('-fseman= tic-interposition') + # If CLang is old enough to not support -fsemantic-interposition + # then this is our best bet to make mocking in tests working properly. + supported_cc_flags +=3D [ '-O0' ] +endif + add_project_arguments(supported_cc_flags, language: 'c') =20 if cc.has_argument('-Wsuggest-attribute=3Dformat') --=20 2.39.2