[Haskell-cafe] pure ghc

joakim at comex.se joakim at comex.se
Wed Mar 12 07:17:26 UTC 2014

Thank you, that works fine for me!

Från: Marc Ziegert [mailto:Coeus at gmx.de]
Skickat: den 12 mars 2014 00:39
Till: Joakim Goldkuhl
Kopia: haskell-cafe at haskell.org
Ämne: Aw: [Haskell-cafe] pure ghc

that time stamp is generated at link time, not compile time.
to remove it, simply use the "strip" tool:

echo "main = return ()" > c.hs && ghc -fforce-recomp c.hs && mv c c1 && ghc -fforce-recomp c.hs && mv c c2 && md5sum c1 c2 && strip c1 c2 && md5sum c1 c2

Gesendet: Dienstag, 11. März 2014 um 08:27 Uhr
Von: joakim at comex.se<mailto:joakim at comex.se>
An: haskell-cafe at haskell.org<mailto:haskell-cafe at haskell.org>
Betreff: [Haskell-cafe] pure ghc
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 ...
< 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.

_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org<mailto:Haskell-Cafe at haskell.org> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140312/6aef345b/attachment.html>

More information about the Haskell-Cafe mailing list