Merge _stub.o files back in to the .o file
GHC sometimes generates _stub.o files. When it does, ghci doesn't work with compiled files (it forgets to include the _stub.o in the files to link against), and it complicates many building rules (including those inside GHC's makefile).
It would be far better if the _stub.o files were merged back in with the original. This is actually reasonably easy:
b <- doesFileExist stub when b $ do let tmp = res <.> "tmp.o" mv obj tmp exec ["ld","-r","-o",obj,tmp,stub] rm stub rm tmp
While being mainly a feature request, this enhancement also fixes a bug with GHCi loading files with _stub's, so includes a bug fix for free.