public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* prune .note.GNU-stack warning from testsuite
@ 2022-04-21  5:33 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-04-21  5:33 UTC (permalink / raw)
  To: binutils

Hi Nick,
This should fix most of the ld testsuite fallout from your
.note.GNU-stack warnings.  Remaining are
x86_64-w64-mingw32  +FAIL: PR ld/12758
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-5r
x86_64-w64-mingw32  +FAIL: PR ld/19317 (2)
x86_64-w64-mingw32  +FAIL: PR ld/19317 (3)
which I think are all complaints about the -z option.  I'm giving this
patch another round of target testing and will commit if good.

binutils/
	* testsuite/lib/binutils-common.exp (prune_warnings_extra): Remove
	.note.GNU-stack warning.
	(run_dump_test): Call prune_warnings for ld and objcopy output.
ld/
	* testsuite/ld-elf/elf.exp: Disable prune_warnings_extra temporarily
	around test for absent .note.GNU-stack
	* testsuite/ld-cris/globsymw2.s,
	* testsuite/ld-cris/warn3.d: Modify "is not implemented" message
	to avoid dejagnu prune_warnings.

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 55b96980e05..87b0d101c6c 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -637,6 +637,7 @@ proc prune_warnings_extra { 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
+    regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*missing \\.note\\.GNU-stack section\[^\n\]*\n?)+" $text "\\1" text
     return $text
 }
 
@@ -1326,7 +1327,7 @@ proc run_dump_test { name {extra_options {}} } {
 	    send_log "$cmd\n"
 	    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "dump.tmp"]
 	    remote_upload host "dump.tmp"
-	    append comp_output [file_contents "dump.tmp"]
+	    append comp_output [prune_warnings [file_contents "dump.tmp"]]
 	    remote_file host delete "dump.tmp"
 	    remote_file build delete "dump.tmp"
 	    set cmdret [lindex $cmdret 0]
@@ -1343,7 +1344,7 @@ proc run_dump_test { name {extra_options {}} } {
 		send_log "$cmd\n"
 		set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "dump.tmp"]
 		remote_upload host "dump.tmp"
-		append comp_output [file_contents "dump.tmp"]
+		append comp_output [prune_warnings [file_contents "dump.tmp"]]
 		remote_file host delete "dump.tmp"
 		remote_file build delete "dump.tmp"
 		set cmdret [lindex $cmdret 0]
diff --git a/ld/testsuite/ld-cris/globsymw2.s b/ld/testsuite/ld-cris/globsymw2.s
index a9e11ffb900..e05f7b2a431 100644
--- a/ld/testsuite/ld-cris/globsymw2.s
+++ b/ld/testsuite/ld-cris/globsymw2.s
@@ -2,7 +2,7 @@
 	.stabn	162,0,0,0
 ;# A bit like globsymw1.s but containing a valid, working, stabs
 ;# symbol warning construct.
-	.stabs "isatty is not implemented and will always fail",30,0,0,0
+	.stabs "isatty is not implemented, will always fail",30,0,0,0
 	.stabs "globsym1",1,0,0,0
 	.global globsym1
 	.type	globsym1, @function
diff --git a/ld/testsuite/ld-cris/warn3.d b/ld/testsuite/ld-cris/warn3.d
index c01b6cb822e..8cd143565c5 100644
--- a/ld/testsuite/ld-cris/warn3.d
+++ b/ld/testsuite/ld-cris/warn3.d
@@ -4,7 +4,7 @@
 #target: cris-*-*elf* cris-*-*aout*
 #as: --em=crisaout
 #ld: -mcrisaout
-#warning: warning: isatty is not implemented and will always fail$
+#warning: warning: isatty is not implemented, will always fail$
 #objdump: -p
 .*:     file format a\.out-cris
 #pass
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index ec61e659e06..8d73fa38f10 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -227,7 +227,7 @@ if {   [istarget *-*-*linux*]
 	    {pr23900-1.s} \
 	    [list [list "readelf" {-Wl} $pr23900_1_exp]] \
 	    "pr23900-1.exe"] \
-	[list "PR ld/29072 (warn about an executable .note-GNU-stack)" \
+	[list "PR ld/29072 (warn about an executable .note.GNU-stack)" \
 	    "-e 0" \
 	    "" \
 	    "" \
@@ -250,8 +250,12 @@ if {   [istarget *-*-*linux*]
 	    "pr29072-d.exe"] \
 	]
     if { [target_defaults_to_execstack] } {
+	rename prune_warnings_extra old_prune_warnings_extra
+	proc prune_warnings_extra { text } {
+	    return $text
+	}
 	run_ld_link_tests [list \
-          [list "PR ld/29072 (warn about absent .note-GNU-stack)" \
+          [list "PR ld/29072 (warn about absent .note.GNU-stack)" \
 	    "-e 0 -z stack-size=0x123400" \
 	    "" \
 	    "" \
@@ -259,9 +263,11 @@ if {   [istarget *-*-*linux*]
 	    {{ld pr29072.b.warn}} \
 	    "pr29072-b.exe"] \
 	]
+	rename prune_warnings_extra ""
+	rename old_prune_warnings_extra prune_warnings_extra
     } else {
 	run_ld_link_tests [list \
-          [list "PR ld/29072 (ignore absent .note-GNU-stackk)" \
+          [list "PR ld/29072 (ignore absent .note.GNU-stackk)" \
 	    "-e 0 -z stack-size=0x123400" \
 	    "" \
 	    "" \

-- 
Alan Modra
Australia Development Lab, IBM

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

only message in thread, other threads:[~2022-04-21  5:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21  5:33 prune .note.GNU-stack warning from testsuite Alan Modra

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).