summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-07-06 15:40:43 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-03 10:15:11 -0400
commitbbee89ddfe4b5df14e76d70d92b40648bd5d88b1 (patch)
tree3189ae95c8bd4006f8cbab6207b97843e2cf361e
parentc248e7cc19b27130542a4ff3227ec99d9d50b8d1 (diff)
downloadhaskell-bbee89ddfe4b5df14e76d70d92b40648bd5d88b1.tar.gz
Remove hschooks.c and -no-hs-main for ghc-bin
-rw-r--r--ghc/Main.hs24
-rw-r--r--ghc/ghc-bin.cabal.in4
-rw-r--r--ghc/ghc.mk6
-rw-r--r--ghc/hschooks.c72
-rw-r--r--hadrian/src/Packages.hs2
5 files changed, 3 insertions, 105 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 2db9a99005..b9b1265f1e 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -102,7 +102,6 @@ import Prelude
main :: IO ()
main = do
- initGCStatistics -- See Note [-Bsymbolic and hooks]
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
@@ -917,26 +916,3 @@ unknownFlagsErr fs = throwGhcException $ UsageError $ concatMap oneError fs
fName = takeWhile (/= '=') f
in (fuzzyMatch f flagsWithEq) ++ (fuzzyMatch fName flagsWithoutEq)
| otherwise = fuzzyMatch f allFlags
-
-{- 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 initialize the flags in the RTS.
-
-A byproduct 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 "initGCStatistics"
- initGCStatistics :: IO ()
diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in
index 86d28a00c3..cde0cbcb3e 100644
--- a/ghc/ghc-bin.cabal.in
+++ b/ghc/ghc-bin.cabal.in
@@ -49,11 +49,11 @@ Executable ghc
else
Build-Depends: unix >= 2.7 && < 2.9
- C-Sources: hschooks.c
-
GHC-Options: -Wall
-Wnoncanonical-monad-instances
-Wnoncanonical-monoid-instances
+ -rtsopts=all
+ "-with-rtsopts=-K512M -H -I5 -T"
if flag(internal-interpreter)
-- NB: this is never built by the bootstrapping GHC+libraries
diff --git a/ghc/ghc.mk b/ghc/ghc.mk
index df03c41dbb..6efe63cb0f 100644
--- a/ghc/ghc.mk
+++ b/ghc/ghc.mk
@@ -38,15 +38,9 @@ ghc_stage1_UseGhcForCC = YES
ghc_stage2_UseGhcForCC = YES
ghc_stage3_UseGhcForCC = YES
-ghc_stage1_C_FILES_NODEPS = ghc/hschooks.c
-
ghc_stage2_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
ghc_stage3_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
-ghc_stage1_MORE_HC_OPTS += -no-hs-main
-ghc_stage2_MORE_HC_OPTS += -no-hs-main
-ghc_stage3_MORE_HC_OPTS += -no-hs-main
-
ifeq "$(GhcDebugged)" "YES"
ghc_stage1_MORE_HC_OPTS += -debug
ghc_stage2_MORE_HC_OPTS += -debug
diff --git a/ghc/hschooks.c b/ghc/hschooks.c
deleted file mode 100644
index 87feab370a..0000000000
--- a/ghc/hschooks.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-These routines customise the error messages
-for various bits of the RTS. They are linked
-in instead of the defaults.
-*/
-
-#include "../rts/PosixSource.h"
-
-/*
- * This should be linked against Rts.h from the compiler which is compiling us.
- * For instance, if we are compiling this file to produce the stage1 compiler,
- * we should use Rts.h from stage0.
- */
-#include "Rts.h"
-
-#include "HsFFI.h"
-
-#include <string.h>
-#include <stdbool.h>
-
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-
-void
-initGCStatistics(void)
-{
- /* Workaround for #8754: if the GC stats aren't enabled because the
- compiler couldn't use -Bsymbolic to link the default hooks, then
- initialize them sensibly. See Note [-Bsymbolic and hooks] in
- Main.hs. */
- if (RtsFlags.GcFlags.giveStats == NO_GC_STATS) {
- RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
- }
-}
-
-void
-defaultsHook (void)
-{
- // This helps particularly with large compiles, but didn't work
- // very well with earlier GHCs because it caused large amounts of
- // fragmentation. See rts/sm/BlockAlloc.c:allocLargeChunk().
- RtsFlags.GcFlags.heapSizeSuggestionAuto = true;
-
- RtsFlags.GcFlags.maxStkSize = 512*1024*1024 / sizeof(W_);
-
- initGCStatistics();
-
- // See #3408: the default idle GC time of 0.3s is too short on
- // Windows where we receive console events once per second or so.
- RtsFlags.GcFlags.idleGCDelayTime = SecondsToTime(5);
-}
-
-void
-StackOverflowHook (StgWord stack_size) /* in bytes */
-{
- fprintf(stderr,
- "GHC stack-space overflow: current limit is %zu bytes.\n"
- "Use the `-K<size>' option to increase it.\n",
- (size_t) stack_size);
-}
-
-int main (int argc, char *argv[])
-{
- RtsConfig conf = defaultRtsConfig;
- conf.defaultsHook = defaultsHook;
- conf.rts_opts_enabled = RtsOptsAll;
- conf.stackOverflowHook = StackOverflowHook;
- extern StgClosure ZCMain_main_closure;
-
- hs_main(argc, argv, &ZCMain_main_closure, conf);
-}
diff --git a/hadrian/src/Packages.hs b/hadrian/src/Packages.hs
index f75236cd9a..1a7fbbe5cd 100644
--- a/hadrian/src/Packages.hs
+++ b/hadrian/src/Packages.hs
@@ -179,7 +179,7 @@ timeoutPath = "testsuite/timeout/install-inplace/bin/timeout" <.> exe
-- TODO: Can we extract this information from Cabal files?
-- | Some program packages should not be linked with Haskell main function.
nonHsMainPackage :: Package -> Bool
-nonHsMainPackage = (`elem` [ghc, hp2ps, iserv, touchy, unlit, ghciWrapper])
+nonHsMainPackage = (`elem` [hp2ps, iserv, touchy, unlit, ghciWrapper])
-- TODO: Combine this with 'programName'.
-- | Path to the @autogen@ directory generated by 'buildAutogenFiles'.