public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Commit: Prune warnings about -z execstack when --enable-warn-execstack=yes has been used
@ 2023-06-21 11:09 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-06-21 11:09 UTC (permalink / raw)
  To: binutils

Hi Guys,

  Configuring the linker with --enable-warn-execstack=yes will generate
  warning messages even when an executable stack has been explicitly
  requested via the "-z execstack" linker option.  Since this warning is
  expected, it can safely be pruned from the linker's output.

  I am applying the patch below to fix this, and to add some descriptive
  comments to the prune_warnings_extra proc.
  
Cheers
  Nick

binutils/ChangeLog
2023-06-21  Nick Clifton  <nickc@redhat.com>

	* testsuite/lib/binutils-common.exp (prune_warnings_extra): Prune
	warnings about -z execstack creating an executable stack.

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 530316e54cd..2293895a614 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -640,20 +640,32 @@ proc regexp_diff { file_1 file_2 args } {
 # ld: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5) type : 0xc0010001
 proc prune_warnings_extra { text } {
     global experimental
-    # Warnings are only pruned from non-experimental code (ie code not
-    # on a release branch).  For experimental code we want the warnings
+
+    # Property warnings are only pruned from non-experimental code (ie code
+    # not on a release branch).  For experimental code we want the warnings
     # as they indicate that the sources need to be updated to recognise
     # the new properties.
     if { "$experimental" == "false" } {
 	# The "\\1" is to try to preserve a "\n" but only if necessary.
 	regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*unsupported GNU_PROPERTY_TYPE\[^\n\]*\n?)+" $text "\\1" text
     }
+
     # PR binutils/23898: It is OK to have gaps in build notes.
     regsub -all "(^|\n)(\[^\n\]*: Warning: Gap in build notes detected from\[^\n\]*\n?)+" $text "\\1" text
+
+    # Many tests use assembler source files without a .note.GNU-stack section.
+    # So ignore warnings about it being missing.
     regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*missing \\.note\\.GNU-stack section\[^\n\]*\n?)+" $text "\\1" text
     regsub -all "(^|\n)(\[^\n\]*: NOTE: This behaviour is deprecated\[^\n\]*\n?)+" $text "\\1" text
+
+    # Ignore warnings about RWX segments.
     regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*has a LOAD segment with RWX permissions\[^\n\]*\n?)+" $text "\\1" text
     regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*has a TLS segment with execute permission\[^\n\]*\n?)+" $text "\\1" text
+
+    # Configuring with --enable-warn-execstack=yes will generate warnings if
+    # -z execstack is used.
+    regsub -all "(^|\n)(\[^\n\]*: warning: enabling an executable stack because of -z execstack command line option\[^\n\]*\n?)+" $text "\\1" text
+
     return $text
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-21 11:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 11:09 Commit: Prune warnings about -z execstack when --enable-warn-execstack=yes has been used Nick Clifton

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 read-only IMAP folder(s) and NNTP newsgroup(s).