import CmdLineParser
import Panic ( panic, GhcException(..) )
import Util ( notNull, splitLongestPrefix, split, normalisePath )
+import SrcLoc ( SrcSpan )
import DATA_IOREF ( readIORef )
import EXCEPTION ( throwDyn )
import Maybe ( fromJust )
import Char ( isDigit, isUpper )
import Outputable
+import System.IO ( hPutStrLn, stderr )
+import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage )
+
-- -----------------------------------------------------------------------------
-- DynFlags
| Opt_KeepTmpFiles
deriving (Eq)
-
+
data DynFlags = DynFlags {
ghcMode :: GhcMode,
ghcLink :: GhcLink,
pkgState :: PackageState,
-- hsc dynamic flags
- flags :: [DynFlag]
+ flags :: [DynFlag],
+
+ -- message output
+ log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO ()
}
data HscTarget
| IgnorePackage String
defaultHscTarget
-#if defined(i386_TARGET_ARCH) || defined(sparc_TARGET_ARCH) || defined(powerpc_TARGET_ARCH)
| cGhcWithNativeCodeGen == "YES" = HscAsm
-#endif
| otherwise = HscC
initDynFlags dflags = do
Opt_IgnoreInterfacePragmas,
Opt_OmitInterfacePragmas
- ] ++ standardWarnings
+ ] ++ standardWarnings,
+
+ log_action = \severity srcSpan style msg ->
+ case severity of
+ SevInfo -> hPutStrLn stderr (show (msg style))
+ SevFatal -> hPutStrLn stderr (show (msg style))
+ _ -> hPutStrLn stderr ('\n':show ((mkLocMessage srcSpan msg) style))
}
{-
MaxSimplifierIterations max_iter
]
]
-
else {- opt_level >= 1 -} [
-- initial simplify: mk specialiser happy: minimum effort please
------ Compiler flags -----------------------------------------------
+ , ( "fno-code", NoArg (setTarget HscNothing))
, ( "fasm", AnySuffix (\_ -> setTarget HscAsm) )
, ( "fvia-c", NoArg (setTarget HscC) )
, ( "fvia-C", NoArg (setTarget HscC) )
= ( [], ["-fomit-frame-pointer", "-G0"] )
#elif x86_64_TARGET_ARCH
- = ( [], ["-fomit-frame-pointer"] )
+ = ( [], ["-fomit-frame-pointer",
+ "-fno-asynchronous-unwind-tables"
+ -- the unwind tables are unnecessary for HC code,
+ -- and get in the way of -split-objs. Another option
+ -- would be to throw them away in the mangler, but this
+ -- is easier.
+ ] )
#elif mips_TARGET_ARCH
= ( ["-static"], [] )