X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FAsmCodeGen.lhs;h=fa0ff890a85f313a1270a59cb0964030f5aa2c64;hb=c295ee8ac9d7afb4d660dc3b63c10cca0a0b26e7;hp=1576162167821bf6a47965725543b8531dbcb344;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs index 1576162..fa0ff89 100644 --- a/compiler/nativeGen/AsmCodeGen.lhs +++ b/compiler/nativeGen/AsmCodeGen.lhs @@ -39,6 +39,7 @@ import CLabel ( pprCLabel ) import ErrUtils ( dumpIfSet_dyn ) import DynFlags ( DynFlags, DynFlag(..), dopt ) import StaticFlags ( opt_Static, opt_PIC ) +import Config ( cProjectVersion ) import Digraph import qualified Pretty @@ -131,6 +132,21 @@ nativeCodeGen dflags cmms us -- There's a hack to make this work in PprMach.pprNatCmmTop. Pretty.$$ Pretty.text ".subsections_via_symbols" #endif +#if HAVE_GNU_NONEXEC_STACK + -- On recent GNU ELF systems one can mark an object file + -- as not requiring an executable stack. If all objects + -- linked into a program have this note then the program + -- will not use an executable stack, which is good for + -- security. GHC generated code does not need an executable + -- stack so add the note in: + Pretty.$$ Pretty.text ".section .note.GNU-stack,\"\",@progbits" +#endif + -- And just because every other compiler does, lets stick in + -- an identifier directive: .ident "GHC x.y.z" + Pretty.$$ let compilerIdent = Pretty.text "GHC" Pretty.<+> + Pretty.text cProjectVersion + in Pretty.text ".ident" Pretty.<+> + Pretty.doubleQuotes compilerIdent ) }