From nobody Fri Dec 19 19:07:34 2025 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=1685028293; cv=none; d=zohomail.com; s=zohoarc; b=LripHhbr/riuHXVkyJ23Axc9dn5vch6toR6j6vZ3phy4AzvpeVCP/9EEPbmDy17h5gIc2S9h71NC87FXqNjcHyhoPaVApmAukAeOoXFsXW+PncLZEwgABq4QKWENY5SiIMFW16CcFYfSHdC8z6iApZ7s54PnCWhZ3WJ3d/cAa78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685028293; 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=Ue2IISUToeEGa1zJJrZYBh+J7bbH46VZA+Gd1EDOEyQ=; b=W+2zl+JM3G/DmQcPx01bIGzA8OcWhu49n2p9JLVsLNHhhxBXqaDvpuiSPeKS/6SOFZwOa+9jktO2nhMaXyjdSM7ARzzrLL4wnhky9ulQTME0A1abPILh0eP31LxqTIq6zvVmS7aLj0/1NEX1oHdNFDiP/wIprAx9VAsBCGxTuYE= 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 1685028293501827.6700807451751; Thu, 25 May 2023 08:24:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2Bkv-0004Yk-Rq; Thu, 25 May 2023 10:15:53 -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 1q2Bkr-0004WV-BD for qemu-devel@nongnu.org; Thu, 25 May 2023 10:15:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2Bko-0007YF-RQ for qemu-devel@nongnu.org; Thu, 25 May 2023 10:15:49 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-451-uAMTOqJuNHCJOQG__m1PAg-1; Thu, 25 May 2023 10:15:41 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-96f46e5897eso85654366b.3 for ; Thu, 25 May 2023 07:15:40 -0700 (PDT) Received: from [192.168.10.117] ([2001:b07:6468:f312:48f9:bea:a04c:3dfe]) by smtp.gmail.com with ESMTPSA id t14-20020a170906948e00b0096f8d8bd046sm889250ejx.187.2023.05.25.07.15.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 07:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685024145; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=Ue2IISUToeEGa1zJJrZYBh+J7bbH46VZA+Gd1EDOEyQ=; b=NBUOqvm3xusWjawmKF8fEjFIQAGlvb197TB7C+fgCw+T8+jFI3woSj9+vLjVftZmvZ5t/S GsBHzs+0mKreY8QPMsFIyknNEtEpJp9nWSX1dQ8IfDoxZAfG3D4fHkN+l0tABu7+g4g7JC dpQrBUgHMHC8Gy/banQ5xF6bOZJ2Dj8= X-MC-Unique: uAMTOqJuNHCJOQG__m1PAg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685024139; x=1687616139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ue2IISUToeEGa1zJJrZYBh+J7bbH46VZA+Gd1EDOEyQ=; b=eL75luDgcSnumlEqktMv+Za7uhbo8jNPa+j9ohEGlThHF0LLEHO1De7ACc+NK4UAK+ Vr3+DxYHEH54s6yiXABDzan0wgLd1fe2/zbp5sfHvGlDDwmuwPJYKJzOAEJphigzKrGx oh8DWOySScclK9oMDxAcPs4sruB+OzTBEIlEalI68+tKLKbxJ6CFyvT9A4r9WsbiwyJP xOUeQkljJA/CpNukqv7afsq5s4fjw+JmVe/CEnKD78DxVZ1i3DgcEr9S5jWlQiJQJv1O rjrg6Wlo9KL9pt6sMuyhrjTZATvyNArhQ0UyrmfYvIoQk4JKpWA1G68D1bUO8IJnuRX9 rFHQ== X-Gm-Message-State: AC+VfDwGTJPwnVQBClhOiT8B88zOwfbyoEHYDFcVs2WCDcYSZYAIDiCy wLhqInMJzdqmhWybuFtCzgJGuDpUmJOq5EXzpiZny/CCnh/16i6S8/aONyoR0g48mYj7g2HdmdF oqo728/mHcLhhEF0oKKUZk/DPGCRZOFnRH4oBYBrZ2s3Ne0J9DmoDIwKrcbCqq4IymSLwnaxbNp M= X-Received: by 2002:a17:907:60cc:b0:970:132f:698f with SMTP id hv12-20020a17090760cc00b00970132f698fmr2386779ejc.2.1685024139543; Thu, 25 May 2023 07:15:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5EtY2hCqm9r+Bh5dftpTRBSduBwcdXSMnk3iEa4aQb+dV8+MNOuDqLw4vXllhzOW8ZCDMDig== X-Received: by 2002:a17:907:60cc:b0:970:132f:698f with SMTP id hv12-20020a17090760cc00b00970132f698fmr2386738ejc.2.1685024139094; Thu, 25 May 2023 07:15:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/20] meson: move -no-pie from linker to compiler Date: Thu, 25 May 2023 16:15:16 +0200 Message-Id: <20230525141532.295817-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525141532.295817-1-pbonzini@redhat.com> References: <20230525141532.295817-1-pbonzini@redhat.com> MIME-Version: 1.0 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.129.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, 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: 1685028295148100003 Content-Type: text/plain; charset="utf-8" The large comment in the patch says it all; the -no-pie flag is broken and this is why it was not included in QEMU_LDFLAGS before commit a988b4c5614 ("build: move remaining compiler flag tests to meson", 2023-05-18). And some distros made things even worse, so we have to add it to the compiler command line. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1664 Signed-off-by: Paolo Bonzini --- meson.build | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 448b71ad5b5c..2e47608353d1 100644 --- a/meson.build +++ b/meson.build @@ -265,12 +265,21 @@ endif =20 # Meson currently only handles pie as a boolean for now, so if the user # has explicitly disabled PIE we need to extend our cflags. +# +# -no-pie is supposedly a linker flag that has no effect on the compiler +# command line, but some distros, that didn't quite know what they were +# doing, made local changes to gcc's specs file that turned it into +# a compiler command-line flag. +# +# What about linker flags? For a static build, no PIE is implied by -stat= ic +# which we added above (and if it's not because of the same specs patching, +# there's nothing we can do: compilation will fail, report a bug to your +# distro and do not use --disable-pie in the meanwhile). For dynamic link= ing, +# instead, we can't add -no-pie because it overrides -shared: the linker t= hen +# tries to build an executable instead of a shared library and fails. So +# don't add -no-pie anywhere and cross fingers. :( if not get_option('b_pie') - qemu_common_flags +=3D cc.get_supported_arguments('-fno-pie') - if not get_option('prefer_static') - # No PIE is implied by -static which we added above. - qemu_ldflags +=3D cc.get_supported_link_arguments('-no-pie') - endif + qemu_common_flags +=3D cc.get_supported_arguments('-fno-pie', '-no-pie') endif =20 if not get_option('stack_protector').disabled() --=20 2.40.1