Commit f3f624ae authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Ben Gamari

Include libraries which fill holes as deps when linking.

Fixes the issue reported at https://github.com/haskell/cabal/issues/4755
and fixes #14304 in the GHC tracker.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: bgamari, austin, goldfire

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14304

Differential Revision: https://phabricator.haskell.org/D4057
parent de1b802b
......@@ -1878,8 +1878,10 @@ listVisibleModuleNames dflags =
-- | Find all the 'PackageConfig' in both the preload packages from 'DynFlags' and corresponding to the list of
-- 'PackageConfig's
getPreloadPackagesAnd :: DynFlags -> [PreloadUnitId] -> IO [PackageConfig]
getPreloadPackagesAnd dflags pkgids =
getPreloadPackagesAnd dflags pkgids0 =
let
pkgids = pkgids0 ++ map (toInstalledUnitId . moduleUnitId . snd)
(thisUnitIdInsts dflags)
state = pkgState dflags
pkg_map = pkgIdMap state
preload = preloadPackages state
......
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
SETUP='$(PWD)/Setup' -v0
CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' --enable-shared
T14304: clean
$(MAKE) -s --no-print-directory clean
'$(GHC_PKG)' init tmp.d
'$(TEST_HC)' -v0 --make Setup
# typecheck indef
rm -rf indef/dist
(cd indef; $(CONFIGURE) --ipid "indef-0.1")
(cd indef; $(SETUP) build)
(cd indef; $(SETUP) copy)
(cd indef; $(SETUP) register)
# build p
rm -rf p/dist
(cd p; $(CONFIGURE) --ipid "p-0.1")
(cd p; $(SETUP) build)
(cd p; $(SETUP) copy)
(cd p; $(SETUP) register)
# build indef instantiated with p
rm -rf indef/dist
(cd indef; $(CONFIGURE) --ipid "indef-0.1" --instantiate-with "Sig=p-0.1:P")
(cd indef; $(SETUP) build)
(cd indef; $(SETUP) copy)
(cd indef; $(SETUP) register)
# build th (which tests if we have correct linkage)
rm -rf th/dist
(cd th; $(CONFIGURE))
(cd th; $(SETUP) build)
clean :
$(RM) -r tmp.d inst dist Setup$(exeext)
import Distribution.Simple
main = defaultMain
Warning: -rtsopts and -with-rtsopts have no effect with -shared.
Call hs_init_ghc() from your main() function to set these options.
Warning: -rtsopts and -with-rtsopts have no effect with -shared.
Call hs_init_ghc() from your main() function to set these options.
Warning: -rtsopts and -with-rtsopts have no effect with -shared.
Call hs_init_ghc() from your main() function to set these options.
if config.cleanup:
cleanup = 'CLEANUP=1'
else:
cleanup = 'CLEANUP=0'
test('T14304',
extra_files(['p', 'indef', 'th', 'Setup.hs']),
run_command,
['$MAKE -s --no-print-directory T14304 ' + cleanup])
module Indef where
import Sig
data T = MkT B
name: indef
version: 1.0
build-type: Simple
cabal-version: >= 2.0
library
build-depends: base
signatures: Sig
exposed-modules: Indef
module P where
type B = Foo
newtype Foo = Foo Double
name: p
version: 1.0
build-type: Simple
cabal-version: >= 2.0
library
build-depends: base
exposed-modules: P
{-# LANGUAGE TemplateHaskell #-}
module TH where
$( return [] )
name: th
version: 1.0
build-type: Simple
cabal-version: >= 2.0
library
build-depends: p, indef, base
mixins: p (P as Sig)
exposed-modules: TH
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