[commit: ghc] master: Add comments explaining #8754 (b626c3d)

git at git.haskell.org git at git.haskell.org
Mon Feb 17 12:48:40 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b626c3d4ce0e66216705ba8355c914dc809e3fe7/ghc

>---------------------------------------------------------------

commit b626c3d4ce0e66216705ba8355c914dc809e3fe7
Author: Austin Seipp <austin at well-typed.com>
Date:   Mon Feb 17 06:48:04 2014 -0600

    Add comments explaining #8754
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

b626c3d4ce0e66216705ba8355c914dc809e3fe7
 ghc/Main.hs |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/ghc/Main.hs b/ghc/Main.hs
index 1aa6553..0011aa9 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -77,7 +77,7 @@ import Data.Maybe
 
 main :: IO ()
 main = do
-   defaultsHook
+   defaultsHook -- See Note [-Bsymbolic and hooks]
    hSetBuffering stdout LineBuffering
    hSetBuffering stderr LineBuffering
    GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $ do
@@ -821,4 +821,23 @@ unknownFlagsErr fs = throwGhcException $ UsageError $ concatMap oneError fs
             [] -> ""
             suggs -> "did you mean one of:\n" ++ unlines (map ("  " ++) suggs)) 
 
+{- Note [-Bsymbolic and hooks]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-Bsymbolic is a flag that prevents the binding of references to global
+symbols to symbols outside the shared library being compiled (see `man
+ld`). When dynamically linking, we don't use -Bsymbolic on the RTS
+package: that is because we want hooks to be overridden by the user,
+we don't want to constrain them to the RTS package.
+
+Unfortunately this seems to have broken somehow on OS X: as a result,
+defaultHooks (in hschooks.c) is not called, which does not initialize
+the GC stats. As a result, this breaks things like `:set +s` in GHCi
+(#8754). As a hacky workaround, we instead call 'defaultHooks'
+directly to initalize the flags in the RTS.
+
+A biproduct of this, I believe, is that hooks are likely broken on OS
+X when dynamically linking. But this probably doesn't affect most
+people since we're linking GHC dynamically, but most things themselves
+link statically.
+-}
 foreign import ccall safe "defaultsHook" defaultsHook :: IO ()



More information about the ghc-commits mailing list