diff options
author | Michael Smith <michael@diglumi.com> | 2015-07-23 11:41:16 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-07-23 11:41:48 +0200 |
commit | d2b4df157532adf014789ae9b2496f88369e43ea (patch) | |
tree | 6e54da248af3ae13ca51abfe89b40e33914cdf82 /testsuite | |
parent | d784bdeb62a6b11831c5235a97449ff2a86dcc52 (diff) | |
download | haskell-d2b4df157532adf014789ae9b2496f88369e43ea.tar.gz |
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
Diffstat (limited to 'testsuite')
7 files changed, 71 insertions, 0 deletions
diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo005/A005.hsig b/testsuite/tests/driver/dynamicToo/dynamicToo005/A005.hsig new file mode 100644 index 0000000000..75d621cfec --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo005/A005.hsig @@ -0,0 +1,5 @@ + +module A005 where + +data Maybe a = Nothing | Just a + diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo005/Makefile b/testsuite/tests/driver/dynamicToo/dynamicToo005/Makefile new file mode 100644 index 0000000000..617510eec4 --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo005/Makefile @@ -0,0 +1,16 @@ +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) diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo005/test.T b/testsuite/tests/driver/dynamicToo/dynamicToo005/test.T new file mode 100644 index 0000000000..48460f5135 --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo005/test.T @@ -0,0 +1,8 @@ + +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']) + diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo006/A.hsig b/testsuite/tests/driver/dynamicToo/dynamicToo006/A.hsig new file mode 100644 index 0000000000..f79d5d334f --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo006/A.hsig @@ -0,0 +1,5 @@ + +module A where + +data Maybe a = Nothing | Just a + diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo006/B.hs b/testsuite/tests/driver/dynamicToo/dynamicToo006/B.hs new file mode 100644 index 0000000000..65900e786a --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo006/B.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +module B where + +import A + +b :: Maybe a +b = Nothing diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo006/Makefile b/testsuite/tests/driver/dynamicToo/dynamicToo006/Makefile new file mode 100644 index 0000000000..497f2c0942 --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo006/Makefile @@ -0,0 +1,20 @@ +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) diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo006/test.T b/testsuite/tests/driver/dynamicToo/dynamicToo006/test.T new file mode 100644 index 0000000000..72e06ca524 --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo006/test.T @@ -0,0 +1,9 @@ + +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']) + |