Commit 3aeb4970 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Also build profiling C objs with '-fPIC' when GHC is dynamic.

parent e4001b99
......@@ -795,8 +795,13 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..."
sequence_
[ do let vanillaCcOpts = (componentCcGhcOptions verbosity lbi
libBi clbi libTargetDir filename)
[ do let baseCcOpts = componentCcGhcOptions verbosity lbi
libBi clbi libTargetDir filename
vanillaCcOpts = if isGhcDynamic
-- Dynamic GHC requires C sources to be built
-- with -fPIC for REPL to work. See #2207.
then baseCcOpts { ghcOptFPic = toFlag True }
else baseCcOpts
profCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptProfilingMode = toFlag True,
ghcOptObjSuffix = toFlag "p_o"
......@@ -808,11 +813,7 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
}
odir = fromFlag (ghcOptObjDir vanillaCcOpts)
createDirectoryIfMissingVerbose verbosity True odir
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)
runGhcProg 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