From: Paolo Bonzini <pbonzini@redhat.com>
To: Jessica Clarke <jrtc27@jrtc27.com>, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org,
Christian Ehrhardt <christian.ehrhardt@canonical.com>
Subject: Re: [PATCH v2] Partially revert "build: -no-pie is no functional linker flag"
Date: Fri, 15 Oct 2021 12:28:15 +0200 [thread overview]
Message-ID: <43f5a2b0-0483-9e43-9d6e-d897dd30273a@redhat.com> (raw)
In-Reply-To: <20210805192545.38279-1-jrtc27@jrtc27.com>
On 05/08/21 21:25, Jessica Clarke wrote:
> This partially reverts commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53.
>
> This commit was misguided and broke using --disable-pie on any distro
> that enables PIE by default in their compiler driver, including Debian
> and its derivatives. Whilst -no-pie is not a linker flag, it is a
> compiler driver flag that ensures -pie is not automatically passed by it
> to the linker. Without it, all compile_prog checks will fail as any code
> built with the explicit -fno-pie will fail to link with the implicit
> default -pie due to trying to use position-dependent relocations. The
> only bug that needed fixing was LDFLAGS_NOPIE being used as a flag for
> the linker itself in pc-bios/optionrom/Makefile.
>
> Note this does not reinstate exporting LDFLAGS_NOPIE, as it is unused,
> since the only previous use was the one that should not have existed. I
> have also updated the comment for the -fno-pie and -no-pie checks to
> reflect what they're actually needed for.
>
> Fixes: bbd2d5a8120771ec59b86a80a1f51884e0a26e53
> Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
> ---
> Changes in v2:
> * Actually include the comment change; didn't add the hunk when
> amending...
>
> configure | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 9a79a004d7..8aecd277ed 100755
> --- a/configure
> +++ b/configure
> @@ -2246,9 +2246,11 @@ static THREAD int tls_var;
> int main(void) { return tls_var; }
> EOF
>
> -# Check we support --no-pie first; we will need this for building ROMs.
> +# Check we support -fno-pie and -no-pie first; we will need the former for
> +# building ROMs, and both for everything if --disable-pie is passed.
> if compile_prog "-Werror -fno-pie" "-no-pie"; then
> CFLAGS_NOPIE="-fno-pie"
> + LDFLAGS_NOPIE="-no-pie"
> fi
>
> if test "$static" = "yes"; then
> @@ -2264,6 +2266,7 @@ if test "$static" = "yes"; then
> fi
> elif test "$pie" = "no"; then
> CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
> + CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
> elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
> CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
> CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2021-10-15 10:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-05 19:14 [PATCH] Partially revert "build: -no-pie is no functional linker flag" Jessica Clarke
2021-08-05 19:25 ` [PATCH v2] " Jessica Clarke
2021-10-14 23:30 ` Michael Roth
2021-10-15 0:12 ` Richard Henderson
2021-10-15 0:22 ` Jessica Clarke
2021-10-15 0:39 ` Richard Henderson
2021-10-15 10:28 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43f5a2b0-0483-9e43-9d6e-d897dd30273a@redhat.com \
--to=pbonzini@redhat.com \
--cc=christian.ehrhardt@canonical.com \
--cc=jrtc27@jrtc27.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).