[PATCH] elf: Don't set .note.GNU-stack type to SHT_NOTE

H.J. Lu hjl.tools@gmail.com
Sat Jan 10 03:50:50 GMT 2026


.note.GNU-stack section doesn't conform to SHT_NOTE spec:

https://gabi.xinuos.com/v42/elf/07-pheader.html#note-sections

since it is an empty section with the corresponding fields.  It maps to
PT_GNU_STACK segment, not PT_NOTE segment.  It is inappropriate to set
its type to SHT_NOTE.

Revert

commit c8db2c887b4129732341c4a1a51cdcd3191db271
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Jan 9 08:39:38 2026 +0100

    ELF: give .note.GNU-stack proper section type

and add tests.

gas/

PR ld/33780
* as.c (main): Don't set .note.GNU-stack section type to SHT_NOTE.
* testsuite/gas/elf/elf.exp: Run section-GNU-stack.
* testsuite/gas/elf/section-GNU-stack.d: New file.
* testsuite/gas/elf/section-GNU-stack.s: Likewise.

ld/

PR ld/33780
* ldelf.c (ldelf_after_open): Don't set .note.GNU-stack section
type to SHT_NOTE.
* testsuite/ld-elf/pr33780.d: New file.
* testsuite/ld-elf/pr33780.s: Likewise.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-elf-Don-t-set-.note.GNU-stack-type-to-SHT_NOTE.patch
Type: text/x-patch
Size: 4462 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260110/fbdb3c9d/attachment-0001.bin>


More information about the Binutils mailing list