Commit 3e3aa925 authored by rwbarton's avatar rwbarton
Browse files

Fix linker interaction between Template Haskell and HPC (#9762)

Summary:
I'm not really happy about perpetuating the hackish fix for #8696,
but at least in the context of building with -fhpc, the performance
cost should be negligible.

I'm suspicious about PlainModuleInitLabel and the Windows stuff too,
but I don't know what it does / can't test it (respectively) so I'll
leave those alone for now.

Hopefully out-of-process TH will save us from these hacks some day.

The test is an adaptation of T8696. It's a bit more awkward since
I couldn't think of a way to get cross-module tickbox references
without optimizations (inlining), but ghci doesn't permit -O for
some reason.

Test Plan: harbormaster; validate

Reviewers: austin

Reviewed By: austin

Subscribers: carter, thomie

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

GHC Trac Issues: #9762

Conflicts:
	testsuite/tests/ghci/scripts/all.T
parent cc510b46
......@@ -897,7 +897,7 @@ labelDynamic dflags this_pkg this_mod lbl =
PlainModuleInitLabel m -> not (gopt Opt_Static dflags) && this_pkg /= (modulePackageKey m)
HpcTicksLabel m -> not (gopt Opt_Static dflags) && this_pkg /= (modulePackageKey m)
HpcTicksLabel m -> not (gopt Opt_Static dflags) && this_mod /= m
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False
......
......@@ -44,3 +44,6 @@ T9367:
'$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci < T9367.script > T9367-raw.run.stdout
cmp T9367-raw.run.stdout T9367-raw.stdout
.PHONY: T9762_prep
T9762_prep:
'$(TEST_HC)' $(TEST_HC_OPTS) -O -fhpc -dynamic T9762B.hs
:load T9762A T9762B
T9762A.a
T9762B.b
module T9762A (a) where
-- By marking a INLINE, we create a reference from B to A's tickboxes.
{-# INLINE a #-}
a :: Int
a = 3
module T9762B (b) where
import T9762A (a)
b :: Int
b = a+1
......@@ -193,4 +193,6 @@ test('T9086b', normal, ghci_script, ['T9086b.script'])
test('T9140', combined_output, ghci_script, ['T9140.script'])
test('T9658', normal, ghci_script, ['T9658.script'])
test('T9293', normal, ghci_script_without_flag('-fno-warn-tabs'), ['T9293.script'])
test('T9881', normal, ghci_script, ['T9881.script'])
\ No newline at end of file
test('T9762', [pre_cmd('$MAKE -s --no-print-directory T9762_prep')],
ghci_script, ['T9762.script'])
test('T9881', normal, ghci_script, ['T9881.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