Ticket #703 (closed merge: fixed)
all binaries built by ghc have executable stacks
|Reported by:||duncan||Owned by:||igloo|
|Type of failure:||Difficulty:||Moderate (less than a day)|
|Test Case:||N/A||Blocked By:|
The GNU toolchain supports marking object files that do not need to use an executable stack. Currently all object files produced by GHC lack these notes and so the linker defaults to using an executable stack for the resulting binary.
This makes some people grumpy. In particular it makes the Gentoo QA people grumpy. :-)
The long story: http://www.gentoo.org/proj/en/hardened/gnu-stack.xml
The quick story: Every .S file produced by ghc should include:
Currently this does not happen for either -fasm or -fvia-C.
ghc simply does not emit the .section .note.GNU-stack stuff into the assembly output.
ghc emits C which is then compiled by gcc. The resulting .raw_s file does contain the .section .note.GNU-stack. However ghc then runs the generated assembly through the "evil mangler" which doesn't grok the .section .note.GNU-stack and does not emit it to the final assembly file.
So the solution is to get ghc to emit the .note.GNU-stack in it's native code geneerator and to modify the evil mangler to pass the .note.GNU-stack through to the output.
We may still have a problem with the "split objs" feature (which ghc uses for its own libraries). Hopefully it'd just be a matter of adding .note.GNU-stack to each .s file that is spat out by ghc -split-objs.
For reference see http://bugs.gentoo.org/show_bug.cgi?id=123698