[binutils-gdb] Disable execstack and rwx segments warnings for MIPS targets.

Nick Clifton nickc@sourceware.org
Mon Jun 27 10:39:58 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ed1c7ad8e31a2cfca1d8c8c898ee7cde6ae340ca

commit ed1c7ad8e31a2cfca1d8c8c898ee7cde6ae340ca
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jun 27 11:39:27 2022 +0100

    Disable execstack and rwx segments warnings for MIPS targets.
    
            PR 29263
            * configure.ac: Move HPPA specific code from here...
            * configure.tgt: ... to here.  Add similar code for MIPS.
            Move code for CRIS, MIPS and HPPA to block at start of file.
            * configure: Regenerate.

Diff:
---
 ld/ChangeLog     |  8 ++++++++
 ld/configure     | 14 ++------------
 ld/configure.ac  | 14 ++------------
 ld/configure.tgt | 41 ++++++++++++++++++++++++++++++++++++-----
 4 files changed, 48 insertions(+), 29 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 37680ccc09a..650e46ec2a4 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2022-06-27  Nick Clifton  <nickc@redhat.com>
+
+	PR 29263
+	* configure.ac: Move HPPA specific code from here...
+	* configure.tgt: ... to here.  Add similar code for MIPS.
+	Move code for CRIS, MIPS and HPPA to block at start of file.
+	* configure: Regenerate.
+
 2022-06-21  Nick Clifton  <nickc@redhat.com>
 
 	PR 29263
diff --git a/ld/configure b/ld/configure
index 95c21406b41..80db525f930 100755
--- a/ld/configure
+++ b/ld/configure
@@ -15461,12 +15461,7 @@ fi
 
 # By default warn when an executable stack is created due to object files
 # requesting such, not when the user specifies -z execstack.
-case "${target}" in
-  # The HPPA port needs to support older kernels that use executable stacks
-  # for signals and syscalls.
-  hppa*-*-*) ac_default_ld_warn_execstack=0 ;;
-  *) ac_default_ld_warn_execstack=2 ;;
-  esac
+ac_default_ld_warn_execstack=2
 # Check whether --enable-warn-execstack was given.
 if test "${enable_warn_execstack+set}" = set; then :
   enableval=$enable_warn_execstack; case "${enableval}" in
@@ -17277,12 +17272,7 @@ _ACEOF
 
 
 if test "${ac_default_ld_warn_rwx_segments}" = unset; then
-  case "${target}" in
-  # The HPPA's PLT section uses a constructed trampoline, hence it needs to
-  # have a RWX segment.
-  hppa*-*-*) ac_default_ld_warn_rwx_segments=0 ;;
-  *) ac_default_ld_warn_rwx_segments=1 ;;
-  esac
+  ac_default_ld_warn_rwx_segments=1
 fi
 
 cat >>confdefs.h <<_ACEOF
diff --git a/ld/configure.ac b/ld/configure.ac
index d587c46cc51..a54a2801889 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -206,12 +206,7 @@ esac])
 
 # By default warn when an executable stack is created due to object files
 # requesting such, not when the user specifies -z execstack.
-[case "${target}" in
-  # The HPPA port needs to support older kernels that use executable stacks
-  # for signals and syscalls.
-  hppa*-*-*) ac_default_ld_warn_execstack=0 ;;
-  *) ac_default_ld_warn_execstack=2 ;;
-  esac]
+ac_default_ld_warn_execstack=2
 AC_ARG_ENABLE(warn-execstack,
 	      AS_HELP_STRING([--enable-warn-execstack],
 	      [enable warnings when creating an executable stack]),
@@ -569,12 +564,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_WARN_EXECSTACK,
   [Define to 1 if you want to enable --warn-execstack in ELF linker by default.])
 
 if test "${ac_default_ld_warn_rwx_segments}" = unset; then
-  [case "${target}" in
-  # The HPPA's PLT section uses a constructed trampoline, hence it needs to
-  # have a RWX segment.
-  hppa*-*-*) ac_default_ld_warn_rwx_segments=0 ;;
-  *) ac_default_ld_warn_rwx_segments=1 ;;
-  esac]
+  ac_default_ld_warn_rwx_segments=1 ;;
 fi
 AC_DEFINE_UNQUOTED(DEFAULT_LD_WARN_RWX_SEGMENTS,
   $ac_default_ld_warn_rwx_segments,
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 7af33b22481..4f9e1b30bf9 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -40,6 +40,42 @@ targ_extra_ofiles="ldelf.o ldelfgen.o"
 targ64_extra_emuls=
 targ64_extra_libpath=
 
+# By default the linker will generate warnings if it is creating an
+# executable stack or a segment with all three of read, write and
+# execute permissions.  These settings are not appropriate for all
+# targets however, so we can change them here:
+
+if test "${ac_default_ld_warn_rwx_segments}" = unset; then
+  case "${targ}" in
+      # The CRIS default linker script yields just one segment
+      # as intended, so a rwx segment warning is not helpful.
+      # The HPPA's PLT section uses a constructed trampoline
+      # hence it needs to have a RWX segment.
+      # Many MIPS targets use executable segments.
+    cris-*-* | crisv32-*-* | \
+    hppa*-*-* | \
+    mips*-*-*)
+      ac_default_ld_warn_rwx_segments=0
+      ;;
+    *)
+      ;;
+  esac
+fi
+
+if test "${ac_default_ld_warn_execstack}" = 2; then
+  case "${targ}" in
+      # The HPPA port needs to support older kernels that
+      # use executable stacks for signals and syscalls.
+      # Many MIPS targets use executable stacks.
+    hppa*-*-* | \
+    mips*-*-*)
+      ac_default_ld_warn_execstack=0
+      ;;
+    *)
+      ;;
+  esac
+fi
+
 # Please try to keep this table more or less in alphabetic order - it
 # makes it much easier to lookup a specific archictecture.
 case "${targ}" in
@@ -235,11 +271,6 @@ cris-*-linux-* | crisv32-*-linux-*)
 cris-*-* | crisv32-*-*)	targ_emul=criself
 			targ_extra_emuls="crisaout crislinux"
 			targ_extra_libpath=$targ_extra_emuls
-			# The default linker script yields just one segment
-			# as intended, and then a warning is not helpful.
-			if test "${ac_default_ld_warn_rwx_segments}" = unset; then
-			  ac_default_ld_warn_rwx_segments=0
-			fi
 			;;
 crx-*-elf*)		targ_emul=elf32crx
 			;;


More information about the Binutils-cvs mailing list