GHC 9.0.2, 9.2.1, (probably master too) RTS with make build erroneously requires execstack on x86_64-linux (and others)
Summary
GHC 9.0.2, 9.2.1, (probably master too) with make build on (at least) x86_64-linux produces execstack required libHSrts.
This happens because rts/ghc.mk
contains
ifneq "$(GhcUnregisterised)" "YES"
rts_S_SRCS += rts/StgCRunAsm.S
endif
which causes StgCRunAsm.o to be built and linked into the RTS, even though the result of preprocessing is an empty file.
The preprocessor produces an empty StgCRunAsm.s from StgCRunAsm.S because none of the architecture ifdefs match. Though the assembly file contains no code, the lack of .note.GNU-stack
leads to the execstack requirement.
Steps to reproduce
Build GHC 9.0.2 using the make build system and use execstack -q rts/dist/build/libHSrts-ghc9.0.2.so
to see that exec stack is required:
$ execstack -q rts/dist/build/libHSrts-ghc9.0.2.so
X rts/dist/build/libHSrts-ghc9.0.2.so
Expected behavior
Execstack should not be required:
$ execstack -q rts/dist/build/libHSrts-ghc9.0.2.so
- rts/dist/build/libHSrts-ghc9.0.2.so
I confirmed that adding .section .note.GNU-stack,"",@progbits
to StgCRunAsm.S results in the RTS not needed execstack.
Environment
- GHC version used: 9.0.2
Optional:
- Operating System: Linux
- System Architecture: x86_64