Commit 6469fea7 authored by Matthew Pickering's avatar Matthew Pickering Committed by Marge Bot
Browse files

Don't write o-boot files in Interactive mode

We should not be producing object files when in interactive mode but we
still produced the dummy o-boot files. These never made it into a
`Linkable` but then confused the recompilation checker.

Fixes #22669
parent 336b2b1c
......@@ -578,21 +578,33 @@ runHscBackendPhase pipe_env hsc_env mod_name src_flavour location result = do
next_phase = hscPostBackendPhase src_flavour (backend dflags)
case result of
HscUpdate iface ->
do
case src_flavour of
HsigFile -> do
-- We need to create a REAL but empty .o file
-- because we are going to attempt to put it in a library
let input_fn = expectJust "runPhase" (ml_hs_file location)
basename = dropExtension input_fn
compileEmptyStub dflags hsc_env basename location mod_name
-- In the case of hs-boot files, generate a dummy .o-boot
-- stamp file for the benefit of Make
HsBootFile -> touchObjectFile logger dflags o_file
HsSrcFile -> panic "HscUpdate not relevant for HscSrcFile"
return ([], iface, emptyHomeModInfoLinkable, o_file)
if | not (backendGeneratesCode (backend dflags)) ->
panic "HscUpdate not relevant for NoBackend"
| not (backendGeneratesCodeForHsBoot (backend dflags)) -> do
-- In Interpreter way, there is just no linkable for hs-boot files
-- and we don't want to write an empty `o-boot` file when we're not
-- supposed to be writing any .o files (#22669)
return ([], iface, emptyHomeModInfoLinkable, o_file)
| otherwise -> do
case src_flavour of
HsigFile -> do
-- We need to create a REAL but empty .o file
-- because we are going to attempt to put it in a library
let input_fn = expectJust "runPhase" (ml_hs_file location)
basename = dropExtension input_fn
compileEmptyStub dflags hsc_env basename location mod_name
-- In the case of hs-boot files, generate a dummy .o-boot
-- stamp file for the benefit of Make
HsBootFile -> touchObjectFile logger dflags o_file
HsSrcFile -> panic "HscUpdate not relevant for HscSrcFile"
-- MP: I wonder if there are any lurking bugs here because we
-- return Linkable == emptyHomeModInfoLinkable, despite the fact that there is a
-- linkable (.o-boot) which we check for in `Iface/Recomp.hs` and
-- then will carry around the linkable if we're doing
-- recompilation.
return ([], iface, emptyHomeModInfoLinkable, o_file)
HscRecomp { hscs_guts = cgguts,
hscs_mod_location = mod_location,
hscs_partial_iface = partial_iface,
......
......@@ -786,4 +786,10 @@ T22044:
# Test the file exists and is preprocessed
"$(TEST_HC)" $(TEST_HC_OPTS) -v0 T22044.hs
.PHONY: T22669
T22669:
echo ":q" | "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --interactive T22669
! test -f T22669.o-boot
......@@ -319,3 +319,4 @@ test('T21869', [js_broken(22261), when(unregisterised(), skip)], makefile_test,
test('T22044', normal, makefile_test, [])
test('T22048', [only_ways(['normal']), grep_errmsg("_rule")], compile, ["-O -fomit-interface-pragmas -ddump-simpl"])
test('T21722', normal, compile_fail, ['-fno-show-error-context'])
test('T22669', normal, makefile_test, [])
Supports Markdown
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