From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 815ACC4332F for ; Sun, 12 Nov 2023 18:44:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2FQR-0005h1-FH; Sun, 12 Nov 2023 13:43:16 -0500 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 1r2FQM-0005gj-TY for qemu-devel@nongnu.org; Sun, 12 Nov 2023 13:43:11 -0500 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 1r2FQH-0002XU-6D for qemu-devel@nongnu.org; Sun, 12 Nov 2023 13:43:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699814584; 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: in-reply-to:in-reply-to:references:references; bh=mwTJKcwfepq5ihk6QtJsohNKQQcTYcatZflpB/K5Pf0=; b=doPvCPmcYX9dBYrJhYeIPWxihdfMcVMw1D7v/HMDpkucbEaNX/iZMxOSY16k1klZ4/G670 NaTctPkh6t1BuCJ4igwgfjFzWcW6m2JWZsr+u30igH6bq40UzB6PdU1y3k+F4/JFPamkZz 5nQnEhMPE0KsjiM3TWy99xMU8+AgEDY= Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-53-6nRORqPPPhGwnovQgFChYQ-1; Sun, 12 Nov 2023 13:43:01 -0500 X-MC-Unique: 6nRORqPPPhGwnovQgFChYQ-1 Received: by mail-ua1-f72.google.com with SMTP id a1e0cc1a2514c-7b9b2b08b42so4184690241.1 for ; Sun, 12 Nov 2023 10:43:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699814581; x=1700419381; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mwTJKcwfepq5ihk6QtJsohNKQQcTYcatZflpB/K5Pf0=; b=P1QCaZammXfQa4qMIyp6nfGYB4ISB50ZmUPJJ4XJD3hye8hghHVNuWJs5bL0zafPhu okk25ZqCESKKyonPcTZ+KOimU3HeoFkLKlYhSct4RoCrS/mFnHVqmaZo+cHIn5NHqWGl YB6qMYtdaCR11epKlEzvjDgAEDn5IYl5UPjNMycE2KoWa7oXWa2KtGp9rWPkwdx4PnNz Yw019A4rjbHlYoTFcRQeCvX6s15aC91Jq73EBlg4kAipfurs9zHZBxHydo6iur9SlNYf K0Da6xedBvLSCGz6zfsZuOzk/hH5HOzVU/59V3++pk+C3VxhSttDxGh1z6avslE+DHto 4vYw== X-Gm-Message-State: AOJu0Yx4xgi3rFq+JS9BZlGy8jtOKrtJalNQr4E0lY3i2xneA5gAH8D0 QOiPN+1A5ToRNbr0zkqP9bi6odAIPkMB7O7gcn6PxWnRlcjEpvBRp2DL5KXe7fjGUNyKcbc3Q16 7hzaDKDHV6LJta1KLsEtDa8DKtIkosrNMecNKktCUUg== X-Received: by 2002:a05:6102:c9:b0:452:6478:3e24 with SMTP id u9-20020a05610200c900b0045264783e24mr3456802vsp.12.1699814580828; Sun, 12 Nov 2023 10:43:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEb+7heKdfjBZVu/GcJ7bN0NoPRd3SJxlXypaa4uGcCNIU27hM8JMYh2bqQ2bLa4kpAnANPtzTeP/ETyUTDMnU= X-Received: by 2002:a05:6102:c9:b0:452:6478:3e24 with SMTP id u9-20020a05610200c900b0045264783e24mr3456798vsp.12.1699814580522; Sun, 12 Nov 2023 10:43:00 -0800 (PST) MIME-Version: 1.0 References: <610aad34-da0b-4b8a-aa22-4ad19513ae28@tls.msk.ru> In-Reply-To: <610aad34-da0b-4b8a-aa22-4ad19513ae28@tls.msk.ru> From: Paolo Bonzini Date: Sun, 12 Nov 2023 18:03:47 +0100 Message-ID: Subject: Re: disable-pie build To: Michael Tokarev Cc: QEMU Developers Content-Type: multipart/alternative; boundary="00000000000041a9270609f8ecff" 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --00000000000041a9270609f8ecff Content-Type: text/plain; charset="UTF-8" Il sab 11 nov 2023, 03:40 Michael Tokarev ha scritto: > Hi! > > It looks like --disable-pie configure, which uses -fno-pie -no-pie flags > for the compiler, is broken: it does not not tell the *linker* about the > option, so the link fails (at least on debian bookworm): > > /usr/bin/ld: libcommon.fa.p/hw_core_cpu-common.c.o: relocation R_X86_64_32 > against `.rodata' can not be used when making a PIE object; recompile with > -fPIE > /usr/bin/ld: failed to set dynamic section sizes: bad value > > This is failing for *all* executables, including tests, qemu-img, etc. > Is this new in bookworm? And also can you compare 8.0, 8.1 and 8.2? Paolo The following change fixes it: > > diff --git a/meson.build b/meson.build > index a9c4f28247..0b7ca45d48 100644 > --- a/meson.build > +++ b/meson.build > @@ -278,7 +278,8 @@ endif > # 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 += cc.get_supported_arguments('-fno-pie', '-no-pie') > + qemu_common_flags += cc.get_supported_arguments('-fno-pie') > + qemu_ldflags += cc.get_supported_arguments('-no-pie') > endif > > if not get_option('stack_protector').disabled() > > > --00000000000041a9270609f8ecff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Il sab 11 nov 2023, 03:40 Michael Tokarev <mjt@tls.msk.ru> ha scritto:
Hi!

It looks like --disable-pie configure, which uses -fno-pie -no-pie flags for the compiler, is broken: it does not not tell the *linker* about the option, so the link fails (at least on debian bookworm):

/usr/bin/ld: libcommon.fa.p/hw_core_cpu-common.c.o: relocation R_X86_64_32 = against `.rodata' can not be used when making a PIE object; recompile w= ith
-fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value

This is failing for *all* executables, including tests, qemu-img, etc.
<= /blockquote>

Is th= is new in bookworm? And also can you compare 8.0, 8.1 and 8.2?

Paolo

The following change fixes it:

diff --git a/meson.build b/meson.build
index a9c4f28247..0b7ca45d48 100644
--- a/meson.build
+++ b/meson.build
@@ -278,7 +278,8 @@ endif
=C2=A0 # tries to build an executable instead of a shared library and fails= .=C2=A0 So
=C2=A0 # don't add -no-pie anywhere and cross fingers. :(
=C2=A0 if not get_option('b_pie')
-=C2=A0 qemu_common_flags +=3D cc.get_supported_arguments('-fno-pie'= ;, '-no-pie')
+=C2=A0 qemu_common_flags +=3D cc.get_supported_arguments('-fno-pie'= ;)
+=C2=A0 qemu_ldflags +=3D cc.get_supported_arguments('-no-pie')
=C2=A0 endif

=C2=A0 if not get_option('stack_protector').disabled()


--00000000000041a9270609f8ecff--