Re: smart relinking bug

2006-10-23 Thread Simon Marlow

Lemmih wrote:

On 10/21/06, Bulat Ziganshin <[EMAIL PROTECTED]> 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 ]


Looks good - you can simplify with a ++ instead of the ||, though.

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: Re[2]: smart relinking bug

2006-10-21 Thread Lemmih

On 10/21/06, Bulat Ziganshin <[EMAIL PROTECTED]> 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
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re[2]: smart relinking bug

2006-10-21 Thread Bulat Ziganshin
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




-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: smart relinking bug

2006-10-21 Thread Lemmih

On 10/21/06, Bulat Ziganshin <[EMAIL PROTECTED]> wrote:

Hello Simon,

ghc 6.6 includes smart relinking capability which don't relink exe
file if it already exists and .hs source files was not changed. that's
great but ignores other .o files that can be also linked to program,
for example those that was compiled from C sources:

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?

--
Cheers,
 Lemmih
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


smart relinking bug

2006-10-21 Thread Bulat Ziganshin
Hello Simon,

ghc 6.6 includes smart relinking capability which don't relink exe
file if it already exists and .hs source files was not changed. that's
great but ignores other .o files that can be also linked to program,
for example those that was compiled from C sources:

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  

-- 
Best regards,
 Bulat  mailto:[EMAIL PROTECTED]

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs