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