https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105472
Bug ID: 105472
Summary: [13 regression] .note.GNU-stack breaks many
Solaris/x86 tests
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: ro at gcc dot gnu.org
CC: hjl.tools at gmail dot com
Target Milestone: ---
Target: i386-pc-solaris2.11, x86_64-pc-solaris2.11
Between 20220502 (1cb220498e1f59021dab36c39c5d726e9f070c6a) and 20220503
(2680f5eec23805ab8a344f942ca5a7e180d57905),
many tests began to FAIL on Solaris/x86 with /bin/as:
+FAIL: gcc.target/x86_64/abi/test_3_element_struct_and_unions.c compilation,
-O0
[...]
(332 tests total). The failure is always the same:
Assembler:
"/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S",
line 85 : Syntax error
Near line: " .section .note.GNU-stack,"",@progbits"
This happens because with /bin/as, '-' isn't valid in section names.
However, even with gas which can assemble the test, this doesn't really make
sense: Solaris ld doesn't know or care about .note.GNU-stack, so this has no
effect. Instead, the Solaris security extensions framework is used, which
defaults to non-exec stack on Solaris 11 anyway:
$ sxadm status nxstack
EXTENSION STATUS FLAGS
nxstack enabled (all) u-c--
On top of that, ld provides -z sx=nxstack to control the behaviour on an
per-executable basis.
gld doesn't know about all this, of course, but let's cross that bridge when
the binutils 2.39 release approaches.
The usual way throughout the code base is to guard .note.GNU-stack with
__ELF__ && __linux__ to avoid all this.