Commit cddbf866 authored by's avatar
Browse files

Allow -static to be used after -dynamic

It's still the case that
    -dynamic -static
will leave -fPIC enabled, but it's tricky to avoid that, and we already
have similar situations where for example
    -XRankNTypes -XNoRankNTypes
will leave ExplicitForAll enabled.
parent 29ee75a0
......@@ -1779,13 +1779,10 @@ dynamic_flags = [
-- is required to get the RTS ticky support.
----- Linker --------------------------------------------------------
-- -static is the default. If -dynamic has been given then, due to the
-- way wayExtras is currently used, we've already set -DDYNAMIC etc.
-- It's too fiddly to undo that, so we just give an error if
-- Opt_Static has been unset.
, Flag "static" (noArgM (\dfs -> do unless (dopt Opt_Static dfs) (addErr "Can't use -static after -dynamic")
return dfs))
, Flag "dynamic" (NoArg (unSetDynFlag Opt_Static >> addWay WayDyn))
, Flag "static" (NoArg (do setDynFlag Opt_Static
removeWay WayDyn))
, Flag "dynamic" (NoArg (do unSetDynFlag Opt_Static
addWay WayDyn))
-- ignored for compat w/ gcc:
, Flag "rdynamic" (NoArg (return ()))
......@@ -2737,6 +2734,9 @@ addWay w = do upd (\dfs -> dfs { ways = w : ways dfs })
dfs <- liftEwM getCmdLineState
wayExtras (targetPlatform dfs) w
removeWay :: Way -> DynP ()
removeWay w = upd (\dfs -> dfs { ways = filter (w /=) (ways dfs) })
setDynFlag, unSetDynFlag :: DynFlag -> DynP ()
setDynFlag f = upd (\dfs -> dopt_set dfs f)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment