[PATCH] ld: testcase for .note.GNU-stack wanting to be SHT_NOTE

Jan Beulich jbeulich@suse.com
Mon Jan 19 14:24:59 GMT 2026


If --noexecstack is removed and instead of empty.s a source file is used
which explicitly creates a @progbits .note.GNU-stack, the test fails (for
the absence of a NOTE segment).
---
Note that for hppa64 this triggers a similar (but not identical) SEGV as
the ones reported with
https://sourceware.org/pipermail/binutils/2025-December/146152.html.
Nothing has happened there yet, so this new one is just adding to the
pile.

I first thought to add a test to ld-elf/notes.exp, and hence looked there.
Why is the sole test there passing -r to the linker when producing
note1.so? That's pretty confusing, as it's not even clear which way to
possibly correct it.

--- /dev/null
+++ b/ld/testsuite/ld-elf/note2.d
@@ -0,0 +1,18 @@
+#name: .note.GNU-stack using SHT_NOTE
+#source: empty.s
+#source: property-or-1.s
+#as: --noexecstack --generate-missing-build-notes=no
+#ld: -shared --script note2.t
+#readelf: --notes
+#target: [check_shared_lib_support]
+# Assembly source file for the HPPA assembler is renamed and modifed by
+# sed.  mn10300 has relocations in .note.gnu.property section which
+# elf_parse_notes doesn't support.
+#notarget: am33_2.0-*-* hppa*-*-hpux* mn10300-*-*
+
+#...
+Displaying notes found in: .note
+[ 	]+Owner[ 	]+Data size[ 	]+Description
+  GNU                  0x[0-9a-f]+	NT_GNU_PROPERTY_TYPE_0
+      Properties: UINT32_OR .*
+#pass
--- /dev/null
+++ b/ld/testsuite/ld-elf/note2.t
@@ -0,0 +1,7 @@
+SECTIONS
+{
+  . = . + SIZEOF_HEADERS;
+  .text : { *(.text) *(.plt) *(.rodata) *(.got*) }
+  .note : { *(.note) *(.note.*) }
+  /DISCARD/ : { *(*) }
+}



More information about the Binutils mailing list