.gnu.build.attributes : { *(.gnu.build.attributes${RELOCATING+ .gnu.build.attributes.*}) }
EOF
+
+test -z "${CONSTRUCTING}" && cat <<EOF
+ .note.GNU-stack : { *(.note.GNU-stack) }
+EOF
--- /dev/null
+ .section .note.GNU-stack, "", %progbits
--- /dev/null
+#name: .note.GNU-stack ld -r SHT_NOTE + SHT_PROGBITS (positive)
+#source: empty.s --noexecstack
+#source: note3.s
+#as: --generate-missing-build-notes=no
+#ld: -r
+#readelf: -SW
+
+#...
+ *\[[ 0-9]+\] \.note\.GNU-stack +NOTE .*
+#pass
--- /dev/null
+#name: .note.GNU-stack ld -r SHT_NOTE + SHT_PROGBITS (negative)
+#source: empty.s --noexecstack
+#source: note3.s
+#as: --generate-missing-build-notes=no
+#ld: -r
+#readelf: -SW
+#failif
+# cr16 and crx force entirely empty scripts for -r, while hppa-elf re-uses
+# a significantly shrunk down script also for -r.
+#xfail: cr16-*-elf* crx-*-elf* hppa-*-*elf* hppa*-*-lites*
+
+#...
+ *\[[ 0-9]+\] \.note\.GNU-stack +PROGBITS .*
+#pass
--- /dev/null
+#name: .note.GNU-stack ld -r SHT_PROGBITS + SHT_NOTE (positive)
+#source: note3.s
+#source: empty.s --noexecstack
+#as: --generate-missing-build-notes=no
+#ld: -r
+#readelf: -SW
+
+#...
+ *\[[ 0-9]+\] \.note\.GNU-stack +PROGBITS .*
+#pass
--- /dev/null
+#name: .note.GNU-stack ld -r SHT_PROGBITS + SHT_NOTE (negative)
+#source: note3.s
+#source: empty.s --noexecstack
+#as: --generate-missing-build-notes=no
+#ld: -r
+#readelf: -SW
+#failif
+# cr16 and crx force entirely empty scripts for -r, while hppa-elf re-uses
+# a significantly shrunk down script also for -r.
+#xfail: cr16-*-elf* crx-*-elf* hppa-*-*elf* hppa*-*-lites*
+
+#...
+ *\[[ 0-9]+\] \.note\.GNU-stack +NOTE .*
+#pass