qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 5/7] configure: Unnest detection of -z, relro and -z, now


From: Fangrui Song
Subject: Re: [PATCH v2 5/7] configure: Unnest detection of -z, relro and -z, now
Date: Wed, 18 Dec 2019 23:11:05 -0800


On 2019-12-18, Philippe Mathieu-Daudé wrote:
On 12/18/19 11:34 PM, Richard Henderson wrote:
There is nothing about these options that is related to PIE.
Use them unconditionally.

Signed-off-by: Richard Henderson <address@hidden>
---
v2: Do not split into two tests.
---
 configure | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 7a646ec007..2503288654 100755
--- a/configure
+++ b/configure
@@ -2040,9 +2040,6 @@ if test "$pie" != "no" ; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
     LDFLAGS="-pie $LDFLAGS"
     pie="yes"
-    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
-      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
-    fi
   else
     if test "$pie" = "yes"; then
       error_exit "PIE not available due to missing toolchain support"
@@ -2053,6 +2050,12 @@ if test "$pie" != "no" ; then
   fi
 fi
+# Detect support for PT_GNU_RELRO + DT_BIND_NOW.
+# The combination is known as "full relro", because .got is read-only too.
+if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
+  LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
+fi
+
 ##########################################
 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
 # use i686 as default anyway, but for those that don't, an explicit


Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

One nit, .got is also read-only in partial relro. Full relro makes .got.plt
read-only. (On EM_PPC and EM_PPC64, .got.plt is named .plt (yes,
misnomer)).

Reviewed-by: Fangrui Song <address@hidden>



reply via email to

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