}
     # 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
 }
 
            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]
                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]
 
        .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
 
 #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
 
        || [istarget "powerpc64*-*-*"]
        || [istarget "riscv*-*-*"]
        || [istarget "tilegx*-*-*"]
-        || [istarget "tilepro*-*-*"] } {
+       || [istarget "tilepro*-*-*"] } {
          return 0
     }
     return 1
            {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" \
            "" \
            "" \
            "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" \
            "" \
            "" \
            {{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-stack)" \
            "-e 0 -z stack-size=0x123400" \
            "" \
            "" \