Commit ed1aced4 authored by Austin Seipp's avatar Austin Seipp

Fix #8696 - don't generate static intra-package references.

See the comments in Packages.lhs and the ticket for some more explanation.

This is a temporary fix while we consider a way to re-enable intra-package
references in the mean time.
Authored-by: rwbarton's avatarReid Barton <>
Signed-off-by: default avatarAustin Seipp <>
parent beac5252
......@@ -1047,10 +1047,22 @@ isDllName :: DynFlags -> PackageId -> Module -> Name -> Bool
-- Despite the "dll", I think this function just means that
-- the synbol comes from another dynamically-linked package,
-- and applies on all platforms, not just Windows
isDllName dflags this_pkg this_mod name
isDllName dflags _this_pkg this_mod name
| gopt Opt_Static dflags = False
| Just mod <- nameModule_maybe name
= if modulePackageId mod /= this_pkg
-- Issue #8696 - when GHC is dynamically linked, it will attempt
-- to load the dynamic dependencies of object files at compile
-- time for things like QuasiQuotes or
-- TemplateHaskell. Unfortunately, this interacts badly with
-- intra-package linking, because we don't generate indirect
-- (dynamic) symbols for intra-package calls. This means that if a
-- module with an intra-package call is loaded without its
-- dependencies, then GHC fails to link. This is the cause of #
-- In the mean time, always force dynamic indirections to be
-- generated: when the module name isn't the module being
-- compiled, references are dynamic.
= if mod /= this_mod
then True
else case dllSplit dflags of
Nothing -> False
:set -fobject-code
:load T8696A T8696B
module T8696A (a) where
{-# NOINLINE a #-}
a :: Int
a = 3
module T8696B (b) where
import T8696A (a)
b :: Int
b = a+1
......@@ -165,3 +165,4 @@ test('T8640', normal, ghci_script, ['T8640.script'])
test('T8579', normal, ghci_script, ['T8579.script'])
test('T8649', normal, ghci_script, ['T8649.script'])
test('T8674', normal, ghci_script, ['T8674.script'])
test('T8696', normal, ghci_script, ['T8696.script'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment