X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FStaticFlagParser.hs;h=bcc96a676f458bb910560301c6cc7f46beff9cd6;hb=930421d4ed09e5389e0ef4c5eef36075a6809cc0;hp=a153435967d6c24e9fadf5df47b62f2383051297;hpb=740618f2b7d822f53528d271ccfb617c8ce84c55;p=ghc-hetmet.git diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index a153435..bcc96a6 100644 --- a/compiler/main/StaticFlagParser.hs +++ b/compiler/main/StaticFlagParser.hs @@ -138,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))) @@ -147,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` [