diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-08-21 14:45:44 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-08-21 14:45:44 +0000 |
commit | 9b645e9e5413fe060c1483171fc98f5baec1c6a4 (patch) | |
tree | 1f31998f523caf20ccb813082e36215a5939b302 /compiler/main/StaticFlagParser.hs | |
parent | e0939bc459e2fd5420f875ee3065dca14114bf31 (diff) | |
download | haskell-9b645e9e5413fe060c1483171fc98f5baec1c6a4.tar.gz |
-fPIC -fvia-C issues a warning and ignores -fvia-C
Also, -fPIC causes an error if the target is registerised and has no
native code generator.
Diffstat (limited to 'compiler/main/StaticFlagParser.hs')
-rw-r--r-- | compiler/main/StaticFlagParser.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index a153435967..bcc96a676f 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-<blah>" options cancel out "-f<blah>" 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` [ |