Skip to content
Snippets Groups Projects
Commit 5462f486 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

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

parent 79ccaa85
No related merge requests found
...@@ -767,8 +767,13 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do ...@@ -767,8 +767,13 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do
unless (null (cSources libBi)) $ do unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..." info verbosity "Building C Sources..."
sequence_ sequence_
[ do let vanillaCcOpts = (componentCcGhcOptions verbosity lbi [ do let baseCcOpts = componentCcGhcOptions verbosity lbi
libBi clbi libTargetDir filename) 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 { profCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptProfilingMode = toFlag True, ghcOptProfilingMode = toFlag True,
ghcOptObjSuffix = toFlag "p_o" ghcOptObjSuffix = toFlag "p_o"
...@@ -780,11 +785,7 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do ...@@ -780,11 +785,7 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do
} }
odir = fromFlag (ghcOptObjDir vanillaCcOpts) odir = fromFlag (ghcOptObjDir vanillaCcOpts)
createDirectoryIfMissingVerbose verbosity True odir createDirectoryIfMissingVerbose verbosity True odir
runGhcProg (if isGhcDynamic runGhcProg vanillaCcOpts
-- Dynamic GHC requires C sources to be built with
-- -fPIC for REPL to work. See #2207.
then vanillaCcOpts { ghcOptFPic = toFlag True }
else vanillaCcOpts)
whenSharedLib forceSharedLib (runGhcProg sharedCcOpts) whenSharedLib forceSharedLib (runGhcProg sharedCcOpts)
whenProfLib (runGhcProg profCcOpts) whenProfLib (runGhcProg profCcOpts)
| filename <- cSources libBi] | filename <- cSources libBi]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment