-fno-code shouldn't be a mode.
[ghc-hetmet.git] / ghc / compiler / main / DynFlags.hs
index b1eb433..f0c95bc 100644 (file)
@@ -174,6 +174,7 @@ data DynFlag
    | Opt_RecompChecking
    | Opt_DryRun
    | Opt_DoAsmMangling
+   | Opt_WriteIface
    | Opt_ExcessPrecision
    | Opt_ReadUserPackageConf
    | Opt_NoHsMain
@@ -405,6 +406,7 @@ defaultDynFlags =
                        -- a good thing anyway, but it seems fragile.
     
            Opt_DoAsmMangling,
+            Opt_WriteIface,
     
            -- and the default no-optimisation options:
            Opt_IgnoreInterfacePragmas,
@@ -834,8 +836,10 @@ dynamic_flags = [
   ,  ( "stubdir"       , HasArg (upd . setStubDir . Just))
 
        ------- Keeping temporary files -------------------------------------
-  ,  ( "keep-hc-file"   , AnySuffix (\_ -> setDynFlag Opt_KeepHcFiles))
-  ,  ( "keep-s-file"    , AnySuffix (\_ -> setDynFlag Opt_KeepSFiles))
+  ,  ( "keep-hc-file"   , AnySuffix (\_ -> do setDynFlag Opt_KeepHcFiles
+                                              setTarget HscC))
+  ,  ( "keep-s-file"    , AnySuffix (\_ -> do setDynFlag Opt_KeepSFiles
+                                              setTarget HscAsm))
   ,  ( "keep-raw-s-file", AnySuffix (\_ -> setDynFlag Opt_KeepRawSFiles))
   ,  ( "keep-tmp-files" , AnySuffix (\_ -> setDynFlag Opt_KeepTmpFiles))
 
@@ -941,7 +945,8 @@ dynamic_flags = [
 
         ------ Compiler flags -----------------------------------------------
 
-  ,  ( "fno-code",     NoArg (setTarget HscNothing))
+  ,  ( "fno-code",     NoArg (do setTarget HscNothing
+                                  unSetDynFlag Opt_WriteIface))
   ,  ( "fasm",         AnySuffix (\_ -> setTarget HscAsm) )
   ,  ( "fvia-c",       NoArg (setTarget HscC) )
   ,  ( "fvia-C",       NoArg (setTarget HscC) )
@@ -999,7 +1004,8 @@ fFlags = [
   ( "case-merge",                      Opt_CaseMerge ),
   ( "unbox-strict-fields",             Opt_UnboxStrictFields ),
   ( "excess-precision",                        Opt_ExcessPrecision ),
-  ( "asm-mangling",                    Opt_DoAsmMangling )
+  ( "asm-mangling",                    Opt_DoAsmMangling ),
+  ( "write-iface",                      Opt_WriteIface )
   ]
 
 glasgowExtsFlags = [ 
@@ -1266,11 +1272,15 @@ machdepCCOpts dflags
                        -- and get in the way of -split-objs.  Another option
                        -- would be to throw them away in the mangler, but this
                        -- is easier.
-                "-fno-unit-at-a-time"
+                "-fno-unit-at-a-time",
                        -- unit-at-a-time doesn't do us any good, and screws
                        -- up -split-objs by moving the split markers around.
                        -- It's only turned on with -O2, but put it here just
                        -- in case someone uses -optc-O2.
+                "-fno-builtin"
+                       -- calling builtins like strlen() using the FFI can
+                       -- cause gcc to run out of regs, so use the external
+                       -- version.
                ] )
 
 #elif mips_TARGET_ARCH