summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-30 16:36:44 -0400
committerJohn Ericson <git@johnericson.me>2022-04-21 15:10:29 +0000
commit0402804a813ce84d20abee6fd093e3699231ac75 (patch)
treebcb856b1d140b0d61cf370700251962a3f5946a4
parent0c02c9199c26bebde17cd0afd378802c6d622a88 (diff)
downloadhaskell-wip/base-take-care-of-stubs.tar.gz
Move `COMPILING_BASE_PACKAGE` hack from compiler to `base.cabal`wip/base-take-care-of-stubs
I think we we can do better; at the very least we need a Note documenting all the moving parts here. But just moving this like so is still an improvement over the status quo, so I'm eager to start with that. Progress on #21318
-rw-r--r--compiler/GHC/Driver/Pipeline/Execute.hs11
-rw-r--r--libraries/base/base.cabal8
2 files changed, 8 insertions, 11 deletions
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs
index da214cdc20..b6fc7a37d0 100644
--- a/compiler/GHC/Driver/Pipeline/Execute.hs
+++ b/compiler/GHC/Driver/Pipeline/Execute.hs
@@ -343,7 +343,6 @@ runCcPhase cc_phase pipe_env hsc_env input_fn = do
let dflags = hsc_dflags hsc_env
let logger = hsc_logger hsc_env
let unit_env = hsc_unit_env hsc_env
- let home_unit = hsc_home_unit hsc_env
let tmpfs = hsc_tmpfs hsc_env
let platform = ue_platform unit_env
let hcc = cc_phase `eqPhase` HCc
@@ -433,16 +432,6 @@ runCcPhase cc_phase pipe_env hsc_env input_fn = do
++ map GHC.SysTools.Option (
pic_c_flags
- -- Stub files generated for foreign exports references the runIO_closure
- -- and runNonIO_closure symbols, which are defined in the base package.
- -- These symbols are imported into the stub.c file via RtsAPI.h, and the
- -- way we do the import depends on whether we're currently compiling
- -- the base package or not.
- ++ (if platformOS platform == OSMinGW32 &&
- isHomeUnitId home_unit baseUnitId
- then [ "-DCOMPILING_BASE_PACKAGE" ]
- else [])
-
-- GCC 4.6+ doesn't like -Wimplicit when compiling C++.
++ (if (cc_phase /= Ccxx && cc_phase /= Cobjcxx)
then ["-Wimplicit"]
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index e0cd8f4197..57787ebbb6 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -446,6 +446,14 @@ Library
if os(freebsd)
cc-options: -DLIBICONV_PLUG
+ -- Stub files generated for foreign exports references the runIO_closure
+ -- and runNonIO_closure symbols, which are defined in the base package.
+ -- These symbols are imported into the stub.c file via RtsAPI.h, and the
+ -- way we do the import depends on whether we're currently compiling
+ -- the base package or not.
+ if os(windows)
+ cc-options: -DCOMPILING_BASE_PACKAGE
+
-- We need to set the unit id to base (without a version number)
-- as it's magic.
ghc-options: -this-unit-id base