GHC doesn't restore split objects
While working on the new Shake-based build system I came across an annoying problem related to missing split objects ([#note see note]).
I still don't fully understand the reasons behind the problem, but I found that GHC doesn't restore missing split objects, as explained in the example below. I think this is a bug, but maybe this is actually a missing feature. I think it shouldn't be difficult to fix.
module Test (test) where test :: Int test = 0
I compile the above with
ghc -split-objs Test.hs and get two split object files in
Test_o_split. Then if I delete any of these files, or even the whole folder, and rerun
ghc -split-objs Test.hs the compiler doesn't bother to restore split objects, pretending that everything is up-to-date. However, if I delete
Test.o all object files are restored.
Another related issue reported by Neil Mitchell (which may be worth a separate ticket) is that even if we corrupt
Test.o and rerun
ghc -split-objs Test.hs, the compiler doesn't restore the object file (nor missing split objects) to the consistent state.
[=#note Note:] The problem I have is described here: https://github.com/snowleopard/shaking-up-ghc/issues/30. It's not necessary to follow the link to understand this ticket, however I'd appreciate any insight you might have about the reasons behind the problem and/or a possible solution.