[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PULL 03/27] Partially revert "build: -no-pie is no functional linker fl

From: Paolo Bonzini
Subject: [PULL 03/27] Partially revert "build: -no-pie is no functional linker flag"
Date: Wed, 3 Nov 2021 16:04:18 +0100

From: Jessica Clarke <jrtc27@jrtc27.com>

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>
Message-Id: <20210805192545.38279-1-jrtc27@jrtc27.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 039467c04b..07cb7b412a 100755
--- a/configure
+++ b/configure
@@ -1771,9 +1771,11 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
-# 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
+  LDFLAGS_NOPIE="-no-pie"
 if test "$static" = "yes"; then
@@ -1789,6 +1791,7 @@ if test "$static" = "yes"; then
 elif test "$pie" = "no"; then
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then

reply via email to

[Prev in Thread] Current Thread [Next in Thread]