Commit d2b4df15 authored by spinda's avatar spinda Committed by Ben Gamari

Generate .dyn_o files for .hsig files with -dynamic-too

With -dynamic-too, .dyn_o files were not being generated for .hsig
files.  Normally, this is handled in the pipeline; however, the branch
for .hsig files called compileEmptyStub directly instead of going
through runPipeline.  When compiling a Cabal package that included .hsig
files, this triggered a linker error later on, as it expected a .dyn_o
file to have been generated for each .hsig.

The fix is to use runPipeline for .hsig files, just as with .hs files.
Alternately, one could duplicate the logic for handling -dynamic-too in
the .hsig branch, but simply calling runPipeline ends up being much
cleaner.

Test Plan: validate

Reviewers: austin, ezyang, bgamari, thomie

Reviewed By: ezyang, thomie

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1084

GHC Trac Issues: #10660
parent d784bdeb
......@@ -251,7 +251,18 @@ compileOne' m_tc_result mHscMessage
do (iface, changed, details) <-
hscSimpleIface hsc_env tc_result mb_old_hash
hscWriteIface dflags iface changed summary
compileEmptyStub dflags hsc_env basename location
-- #10660: Use the pipeline instead of calling
-- compileEmptyStub directly, so -dynamic-too gets
-- handled properly
let mod_name = ms_mod_name summary
_ <- runPipeline StopLn hsc_env
(output_fn,
Just (HscOut src_flavour mod_name HscUpdateSig))
(Just basename)
Persistent
(Just location)
Nothing
-- Same as Hs
o_time <- getModificationUTCTime object_filename
......
module A005 where
data Maybe a = Nothing | Just a
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
checkExists = [ -f $1 ] || echo $1 missing
.PHONY: dynamicToo005
# Check that "-c -dynamic-too" works with .hsig
dynamicToo005:
"$(TEST_HC)" $(TEST_HC_OPTS) -dynamic-too -v0 \
-sig-of A005=base:Prelude \
-c A005.hsig
$(call checkExists,A005.o)
$(call checkExists,A005.hi)
$(call checkExists,A005.dyn_o)
$(call checkExists,A005.dyn_hi)
test('dynamicToo005',
[extra_clean(['A005.o', 'A005.hi', 'A005.dyn_o', 'A005.dyn_hi']),
unless(have_vanilla(), skip),
unless(have_dynamic(), skip)],
run_command,
['$MAKE -s --no-print-directory dynamicToo005'])
module A where
data Maybe a = Nothing | Just a
{-# LANGUAGE NoImplicitPrelude #-}
module B where
import A
b :: Maybe a
b = Nothing
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
checkExists = [ -f $1 ] || echo $1 missing
.PHONY: dynamicToo006
# Check that "--make -dynamic-too" works with .hsig
dynamicToo006:
"$(TEST_HC)" $(TEST_HC_OPTS) -dynamic-too -v0 \
-sig-of A=base:Prelude \
--make B
$(call checkExists,A.o)
$(call checkExists,B.o)
$(call checkExists,A.hi)
$(call checkExists,B.hi)
$(call checkExists,A.dyn_o)
$(call checkExists,B.dyn_o)
$(call checkExists,A.dyn_hi)
$(call checkExists,B.dyn_hi)
test('dynamicToo006',
[extra_clean(['A.o', 'A.hi', 'A.dyn_o', 'A.dyn_hi',
'B.o', 'B.hi', 'B.dyn_o', 'B.dyn_hi']),
unless(have_vanilla(), skip),
unless(have_dynamic(), skip)],
run_command,
['$MAKE -s --no-print-directory dynamicToo006'])
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