Commit 685bbaee authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Build C sources with -fPIC when GHC is using dynamic libraries.

Fixes #2207.
parent ea062bf5
......@@ -805,7 +805,11 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
odir = fromFlag (ghcOptObjDir vanillaCcOpts)
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg vanillaCcOpts
runGhcProg (if isGhcDynamic
-- Dynamic GHC requires C sources to be built with
-- -fPIC for repl to work. See #2207.
then vanillaCcOpts { ghcOptFPic = toFlag True }
else vanillaCcOpts)
unless forRepl $
whenSharedLib forceSharedLib (runGhcProg sharedCcOpts)
unless forRepl $ whenProfLib (runGhcProg profCcOpts)
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