Improve exprIsCheap
[ghc-hetmet.git] / compiler / nativeGen / AsmCodeGen.lhs
index 1576162..fa0ff89 100644 (file)
@@ -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
             )
    }