[Haskell-cafe] pure ghc

joakim at comex.se joakim at comex.se
Tue Mar 11 07:27:46 UTC 2014


Hello,
If I compile my source code two time I would like to get the same binary. But currently when I run

echo "main = return ()" > c.hs && ghc -fforce-recomp c.hs && xxd c > c1.hex && ghc -fforce-recomp c.hs && xxd c > c2.hex && diff c1.hex c2.hex

my output is

[1 of 1] Compiling Main             ( c.hs, c.o )
Linking c ...
[1 of 1] Compiling Main             ( c.hs, c.o )
Linking c ...
55494c55494
< 00d8c50: 7400 6768 6333 3130 3830 5f30 2e63 0073  t.ghc31080_0.c.s
---
> 00d8c50: 7400 6768 6333 3130 3935 5f30 2e63 0073  t.ghc31095_0.c.s

So why does the binary differ? Is there a way to compile with ghc and get the same binary? Even though only one byte differ, the checksum (sha,md5,..) is completely changed... I'm running Linux and ghc 7.6.3.

Regards,
Joakim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140311/71b1b0cf/attachment.html>


More information about the Haskell-Cafe mailing list