X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FStaticFlagParser.hs;h=966b6ec90c194f3e6f35e7eda3566394c75bb8c4;hb=ac97c15c33cb5658d2da35fd2a6768a4c0556361;hp=31ff9d18eb8e32ba4349feac9bee6d696c1ed542;hpb=5a336f14d30f9b46ac74ca319ed1af25430cd67a;p=ghc-hetmet.git diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index 31ff9d1..966b6ec 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 @@ -106,6 +106,7 @@ 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 @@ -119,6 +120,7 @@ static_flags = [ ------ 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 @@ -127,7 +129,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 @@ -137,6 +139,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))) @@ -146,6 +153,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` [ @@ -166,7 +179,6 @@ isStaticFlag f = "static", "fhardwire-lib-paths", "funregisterised", - "fext-core", "fcpr-off", "ferror-spans", "fPIC",