X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FStaticFlagParser.hs;h=bcc96a676f458bb910560301c6cc7f46beff9cd6;hb=930421d4ed09e5389e0ef4c5eef36075a6809cc0;hp=7ed4c4c25fbfb3df85d8713b9689408a989f7e36;hpb=aedb94f5f220b5e442b23ecc445fd38c8d9b6ba0;p=ghc-hetmet.git diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index 7ed4c4c..bcc96a6 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 @@ -127,7 +128,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 +138,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 +152,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` [ @@ -161,13 +173,11 @@ isStaticFlag f = "fsimple-list-literals", "fno-ds-multi-tyvar", "fruntime-types", - "fpass-case-bndr-to-join-points", "fno-pre-inlining", "fexcess-precision", "static", "fhardwire-lib-paths", "funregisterised", - "fext-core", "fcpr-off", "ferror-spans", "fPIC",