[project @ 2005-07-22 14:00:34 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / DynFlags.hs
index 518a8e9..3b4d306 100644 (file)
@@ -65,7 +65,7 @@ import Data.List      ( isPrefixOf )
 #endif
 import Maybe           ( fromJust )
 import Char            ( isDigit, isUpper )
-
+import Outputable
 -- -----------------------------------------------------------------------------
 -- DynFlags
 
@@ -766,7 +766,7 @@ dynamic_flags = [
   ,  ( "optL"          , HasArg (upd . addOptL) )  
   ,  ( "optP"          , HasArg (upd . addOptP) )  
   ,  ( "optF"           , HasArg (upd . addOptF) )  
-  ,  ( "optc"          , HasArg (\f -> upd (addOptc f . addOpta f)) )
+  ,  ( "optc"          , HasArg (upd . addOptc) )  
   ,  ( "optm"          , HasArg (upd . addOptm) )  
   ,  ( "opta"          , HasArg (upd . addOpta) )  
   ,  ( "optl"          , HasArg (upd . addOptl) )  
@@ -870,7 +870,7 @@ dynamic_flags = [
   ,  ( "dsource-stats",          setDumpFlag Opt_D_source_stats)
   ,  ( "dverbose-core2core",     setDumpFlag Opt_D_verbose_core2core)
   ,  ( "dverbose-stg2stg",       setDumpFlag Opt_D_verbose_stg2stg)
-  ,  ( "ddump-hi-diffs",         setDumpFlag Opt_D_dump_hi_diffs)
+  ,  ( "ddump-hi-diffs",         NoArg (setDynFlag Opt_D_dump_hi_diffs))
   ,  ( "ddump-hi",               setDumpFlag Opt_D_dump_hi)
   ,  ( "ddump-minimal-imports",  setDumpFlag Opt_D_dump_minimal_imports)
   ,  ( "ddump-vect",            setDumpFlag Opt_D_dump_vect)
@@ -1043,18 +1043,17 @@ setOptLevel n dflags
 
 setMainIs :: String -> DynP ()
 setMainIs arg
-  | not (null main_mod)                -- The arg looked like "Foo.baz"
+  | not (null main_fn)         -- The arg looked like "Foo.baz"
   = upd $ \d -> d{ mainFunIs = Just main_fn,
                   mainModIs = Just main_mod }
 
-  | isUpper (head main_fn)     -- The arg looked like "Foo"
-  = upd $ \d -> d{ mainModIs = Just main_fn }
+  | isUpper (head main_mod)    -- The arg looked like "Foo"
+  = upd $ \d -> d{ mainModIs = Just main_mod }
   
   | otherwise                  -- The arg looked like "baz"
-  = upd $ \d -> d{ mainFunIs = Just main_fn }
+  = upd $ \d -> d{ mainFunIs = Just main_mod }
   where
     (main_mod, main_fn) = splitLongestPrefix arg (== '.')
-  
 
 -----------------------------------------------------------------------------
 -- Paths & Libraries
@@ -1226,7 +1225,13 @@ machdepCCOpts dflags
        = ( [], ["-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"], [] )