From nobody Sat May 18 20:15:32 2024 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=1684827118; cv=none; d=zohomail.com; s=zohoarc; b=iW1FObAoVgpih7hP4U9BXjfjKyrL6+ZDC43eYoSCkgmaR27D9bbiULU6xRdqBB/ykm6bsLQmZFDNhqPBD9bgjLFAUR0cz5jEgzb8ZM3GVhGMlD5kagAnxpsQek2fBDUlH/b3fVBRsCnLdYlWzfYT4zgaLmIY6Y9Yb4CWKSWXi7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684827118; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=fpR28WxEL6UJr1zH3CvHH4pkZ0VC6wvHdgt53LgIVhE=; b=kmzkfHgY8Z+DniKhoQ/AikyrI7DElQneyiWjMNUfBaIJMk7GV8FOu1KaSBczAV1dYd7yawTjJ2KUrsqPJcClCBLLfErPnzxzG6FIuSfhFB8FLuUwxjLZqF9/HP/U47rZimL46Z2IESAqxqHTikImcjbewrPuHeC+V+Qth2bjXqs= 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 1684827118293823.9906362691869; Tue, 23 May 2023 00:31:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1MTm-0006R6-Ik; Tue, 23 May 2023 03:30:46 -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 1q1MTd-0006PV-62 for qemu-devel@nongnu.org; Tue, 23 May 2023 03:30:44 -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 1q1MTb-0003mk-AU for qemu-devel@nongnu.org; Tue, 23 May 2023 03:30:36 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-302-WxmMcyrxPXKH_Y4gmI3ouQ-1; Tue, 23 May 2023 03:30:32 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-96fa4c724fdso389737666b.0 for ; Tue, 23 May 2023 00:30:32 -0700 (PDT) Received: from [192.168.10.117] ([2001:b07:6468:f312:48f9:bea:a04c:3dfe]) by smtp.gmail.com with ESMTPSA id hx17-20020a170906847100b00965b5540ad7sm4075502ejc.17.2023.05.23.00.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 00:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684827034; 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-transfer-encoding:content-transfer-encoding; bh=fpR28WxEL6UJr1zH3CvHH4pkZ0VC6wvHdgt53LgIVhE=; b=eRz+VjfA7i8qdX9SzUbOKzDan9N6L0idMcE94yc+tfAQDsz8hTst8mVejX5ePWeBl4SpC7 3uOxHzcWhISbD/LCeJp8M9i+5Me2yQSrZuQvWSt26ZCngiBTsbL3wi34gf8dFdU3IPeHos mdhsoxDRxtBhI8SQbSSFljC64yJT1TY= X-MC-Unique: WxmMcyrxPXKH_Y4gmI3ouQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684827031; x=1687419031; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fpR28WxEL6UJr1zH3CvHH4pkZ0VC6wvHdgt53LgIVhE=; b=DBFmLTyd80914x8/GBIrF9+1FoxNvdBRr78237ca5a5vxlQ20u4YVeMcnRl07+fCO+ NdYrI1a735Vmc9WQCuIBlprsCjUehcI3gX6xCp/ul3GNF8Oojq+YvybF9W9vpORTS5Q1 Bg8RrBeb1nwfvKeKGGiY7x8QDEKruJQEkput/40W/A00tSYXyLKklaoOo/Amjd9Utgbd QS9UZOOtbJIE583H2HNNpSJJ7ZH4troYG5rw1IHdSlfdlWzJ6rMj8aH6HVO0OputPZ22 y3BllmhVf7grzxyiZTu/x8VqW1JriLhG57wCW99zti5CkKVh/IsqHmQKB9Vdx5zrISlb 4xrw== X-Gm-Message-State: AC+VfDwUIcTufd5HHxfE/kHzaecbT0oxUTKRnXJZ9yVA+JkpYtLAyKII qQ9jj3/687Y3oW/08RzCDIHF8oRlvex5q+0I74i48594qclEncXENumYTOok86EYUzeABT6iaNr o0+ckkbkUBJ3sr0fAeUpsDFSDFoXWwY/F5UOOp2eys0v+A8V8z9DZjB1Ls4MYWlW+Qn0TtRiFWc A= X-Received: by 2002:a17:907:985:b0:96f:b40a:c85f with SMTP id bf5-20020a170907098500b0096fb40ac85fmr7248677ejc.23.1684827031419; Tue, 23 May 2023 00:30:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67w3/1mS5X2JsSJGpKV+sqlpzoDLJLJrphE1t4E/JwMHl4FaB+f+lTPpCmYBLE1CE4oEWP8A== X-Received: by 2002:a17:907:985:b0:96f:b40a:c85f with SMTP id bf5-20020a170907098500b0096fb40ac85fmr7248654ejc.23.1684827031074; Tue, 23 May 2023 00:30:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, vr_qemu@t-online.de, richard.henderson@linaro.org Subject: [PATCH v2] meson: move -no-pie from linker to compiler Date: Tue, 23 May 2023 09:30:29 +0200 Message-Id: <20230523073029.19549-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.40.1 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.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: 1684827119492100003 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 Reviewed-by: Richard Henderson Tested-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Richard Henderson Tested-by: Volker R=C3=BCmelin --- meson.build | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 0a5cdefd4d3d..20accae99281 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