X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FStaticFlagParser.hs;h=dd421b8ea932dc14aced0d524841668f298a339d;hb=1d8585bc1160be0c21c34d1f9d9c62e22b3948a8;hp=ae7b00d223108d5f82e9083ad48d3bd38a8078b9;hpb=8b18faef8aeaf40150c208272a2fc117611e8ae8;p=ghc-hetmet.git diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index ae7b00d..dd421b8 100644 --- a/compiler/main/StaticFlagParser.hs +++ b/compiler/main/StaticFlagParser.hs @@ -53,7 +53,7 @@ parseStaticFlags args = do -- deal with the way flags: the way (eg. prof) gives rise to -- further flags, some of which might be static. - way_flags <- findBuildTag + way_flags <- getWayFlags let way_flags' = map (mkGeneralLocated "in way flags") way_flags -- if we're unregisterised, add some more flags @@ -107,7 +107,6 @@ static_flags = [ ------- ways -------------------------------------------------------- , Flag "prof" (NoArg (addWay WayProf)) Supported , Flag "eventlog" (NoArg (addWay WayEventLog)) Supported - , Flag "ticky" (NoArg (addWay WayTicky)) Supported , Flag "parallel" (NoArg (addWay WayPar)) Supported , Flag "gransim" (NoArg (addWay WayGran)) Supported , Flag "smp" (NoArg (addWay WayThreaded)) @@ -115,11 +114,15 @@ static_flags = [ , Flag "debug" (NoArg (addWay WayDebug)) Supported , Flag "ndp" (NoArg (addWay WayNDP)) Supported , Flag "threaded" (NoArg (addWay WayThreaded)) Supported - -- ToDo: user ways + + , Flag "ticky" (PassFlag (\f -> do addOpt f; addWay WayDebug)) Supported + -- -ticky enables ticky-ticky code generation, and also implies -debug which + -- is required to get the RTS ticky support. ------ Debugging ---------------------------------------------------- , Flag "dppr-debug" (PassFlag addOpt) Supported , Flag "dsuppress-uniques" (PassFlag addOpt) Supported + , Flag "dsuppress-coercions" (PassFlag addOpt) Supported , Flag "dppr-user-length" (AnySuffix addOpt) Supported , Flag "dopt-fuel" (AnySuffix addOpt) Supported , Flag "dno-debug-output" (PassFlag addOpt) Supported @@ -128,7 +131,7 @@ static_flags = [ ----- Linker -------------------------------------------------------- , Flag "static" (PassFlag addOpt) Supported - , Flag "dynamic" (NoArg (removeOpt "-static")) Supported + , Flag "dynamic" (NoArg (removeOpt "-static" >> addWay WayDyn)) Supported -- ignored for compat w/ gcc: , Flag "rdynamic" (NoArg (return ())) Supported @@ -138,6 +141,11 @@ static_flags = [ , Flag "Rghc-timing" (NoArg (enableTimingStats)) Supported ------ Compiler flags ----------------------------------------------- + + -- -fPIC requires extra checking: only the NCG supports it. + -- See also DynFlags.parseDynamicFlags. + , Flag "fPIC" (PassFlag setPIC) Supported + -- All other "-fno-" options cancel out "-f" on the hsc cmdline , Flag "fno-" (PrefixPred (\s -> isStaticFlag ("f"++s)) (\s -> removeOpt ("-f"++s))) @@ -147,6 +155,12 @@ static_flags = [ , Flag "f" (AnySuffixPred isStaticFlag addOpt) Supported ] +setPIC :: String -> IO () +setPIC | cGhcWithNativeCodeGen == "YES" || cGhcUnregisterised == "YES" + = addOpt + | otherwise + = ghcError $ CmdLineError "-fPIC is not supported on this platform" + isStaticFlag :: String -> Bool isStaticFlag f = f `elem` [ @@ -167,7 +181,6 @@ isStaticFlag f = "static", "fhardwire-lib-paths", "funregisterised", - "fext-core", "fcpr-off", "ferror-spans", "fPIC", @@ -188,8 +201,7 @@ unregFlags = map (mkGeneralLocated "in unregFlags") [ "-optc-DNO_REGS" , "-optc-DUSE_MINIINTERPRETER" , "-fno-asm-mangling" - , "-funregisterised" - , "-fvia-C" ] + , "-funregisterised" ] ----------------------------------------------------------------------------- -- convert sizes like "3.5M" into integers