projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-fPIC -fvia-C issues a warning and ignores -fvia-C
[ghc-hetmet.git]
/
compiler
/
main
/
StaticFlagParser.hs
diff --git
a/compiler/main/StaticFlagParser.hs
b/compiler/main/StaticFlagParser.hs
index
f3d737c
..
bcc96a6
100644
(file)
--- 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.
-- 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
let way_flags' = map (mkGeneralLocated "in way flags") way_flags
-- if we're unregisterised, add some more flags
@@
-128,7
+128,7
@@
static_flags = [
----- Linker --------------------------------------------------------
, Flag "static" (PassFlag addOpt) Supported
----- 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
-- ignored for compat w/ gcc:
, Flag "rdynamic" (NoArg (return ())) Supported
@@
-138,6
+138,11
@@
static_flags = [
, Flag "Rghc-timing" (NoArg (enableTimingStats)) Supported
------ Compiler 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)))
-- 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
]
, 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` [
isStaticFlag :: String -> Bool
isStaticFlag f =
f `elem` [