smart relinking bug

Lemmih lemmih at gmail.com
Sat Oct 21 14:06:21 EDT 2006


On 10/21/06, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
> Hello Lemmih,
>
> Saturday, October 21, 2006, 8:11:02 PM, you wrote:
>
> >> gcc -c -o a.o a.c
> >> ghc --make Main.hs a.o
> >>
> >> this command incorrectly don't relinks executable if a.c was changed
> >> but Main.hs wasn't
>
> > Did you mean a.o instead of a.c?
>
> if a.c changes then first line will recompile it and change a.o too :)
> for '--make' command a.o will be changed and main.hs remains old

Ah, I didn't read the two lines as a single command.

I think adding something like this to DriverPipeline should fix it:

        extra_ld_inputs <- readIORef v_Ld_inputs
        extra_times <- mapM (IO.try . getModificationTime) extra_ld_inputs)
        let linking_needed
                | Left _  <- e_exe_time = True
                | Right t <- e_exe_time =
                        any (t <) (map linkableTime linkables) ||
                        any (t <) [ t' | Right t' <- extra_times ]


-- 
Cheers,
  Lemmih



More information about the Glasgow-haskell-bugs mailing list