From: Simon Marlow Date: Mon, 21 Jun 2010 10:04:09 +0000 (+0000) Subject: ROLLBACK: picCCOpts: -dynamic should not entail -optc-fPIC X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=f9686dd4f9ff6cee56659319941e136a30fa659d ROLLBACK: picCCOpts: -dynamic should not entail -optc-fPIC and add a comment to explain why it was wrong. This fixes the dyn test failures that sprang up recently. --- diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 6cde987..581d810 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -2205,7 +2205,12 @@ picCCOpts _dflags | otherwise = [] #else - | opt_PIC + -- we need -fPIC for C files when we are compiling with -dynamic, + -- otherwise things like stub.c files don't get compiled + -- correctly. They need to reference data in the Haskell + -- objects, but can't without -fPIC. See + -- http://hackage.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode + | opt_PIC || not opt_Static = ["-fPIC", "-U __PIC__", "-D__PIC__"] | otherwise = []