summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorZiyang Liu <unsafeFixIO@gmail.com>2021-09-14 23:57:24 -0700
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-17 09:38:56 -0400
commit01e07ab13dcff69cd9a88ab56cc83f0a50ec63ae (patch)
tree7d13825e5b5251451ac69f26d3d92391092747d0 /ghc
parentbce230c20eb04c0b557f4a7e4650b009281e717b (diff)
downloadhaskell-01e07ab13dcff69cd9a88ab56cc83f0a50ec63ae.tar.gz
Ensure .dyn_hi doesn't overwrite .hi
This commit fixes the following bug: when `outputHi` is set, and both `.dyn_hi` and `.hi` are needed, both would be written to `outputHi`, causing `.dyn_hi` to overwrite `.hi`. This causes subsequent `readIface` to fail - "mismatched interface file profile tag (wanted "", got "dyn")" - triggering unnecessary rebuild.
Diffstat (limited to 'ghc')
-rw-r--r--ghc/Main.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index b9b1265f1e..b1c45e9cc4 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -321,6 +321,11 @@ checkOptions mode dflags srcs objs = do
then throwGhcException (UsageError "-ohi can only be used when compiling a single source file")
else do
+ if (isJust (dynOutputHi dflags) &&
+ (isCompManagerMode mode || srcs `lengthExceeds` 1))
+ then throwGhcException (UsageError "-dynohi can only be used when compiling a single source file")
+ else do
+
-- -o sanity checking
if (srcs `lengthExceeds` 1 && isJust (outputFile dflags)
&& not (isLinkMode mode))