diff options
author | Ziyang Liu <unsafeFixIO@gmail.com> | 2021-09-14 23:57:24 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-17 09:38:56 -0400 |
commit | 01e07ab13dcff69cd9a88ab56cc83f0a50ec63ae (patch) | |
tree | 7d13825e5b5251451ac69f26d3d92391092747d0 /compiler/GHC/Driver/Main.hs | |
parent | bce230c20eb04c0b557f4a7e4650b009281e717b (diff) | |
download | haskell-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 'compiler/GHC/Driver/Main.hs')
-rw-r--r-- | compiler/GHC/Driver/Main.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index 788c2bce1f..647ce0bf26 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -961,15 +961,15 @@ hscMaybeWriteIface logger dflags is_simple iface old_iface mod_location = do -- mod_location only contains the base name, so we rebuild the -- correct file extension from the dynflags. baseName = ml_hi_file mod_location - buildIfName suffix - | Just name <- outputHi dflags + buildIfName suffix is_dynamic + | Just name <- (if is_dynamic then dynOutputHi else outputHi) dflags = name | otherwise = let with_hi = replaceExtension baseName suffix in addBootSuffix_maybe (mi_boot iface) with_hi write_iface dflags' iface = - let !iface_name = buildIfName (hiSuf dflags') + let !iface_name = buildIfName (hiSuf dflags') (dynamicNow dflags') profile = targetProfile dflags' in {-# SCC "writeIface" #-} |