GHC runs unregisterised on x64-64

Simon Marlow
Thu, 28 Aug 2003 15:59:33 +0100

GHC just produced its first working binary on x86-64 :-D

$ uname -a=20
Linux amd64-linux1 2.4.19-SMP #1 SMP Thu Jul 17 21:37:10 UTC 2003 x86_64
$ cat hello.hs
import System.Info
main =3D print System.Info.arch >> print System.Info.os
$ ./ghc-6.0.1/ghc/compiler/stage1/ghc-inplace hello.hs
$ file a.out
a.out: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
$ ./a.out

Unregisterised, no GHCi so far.  I had to make precisely two changes to
the GHC source code: one to the configure script to recognise this
platform, and one to the known hairy bit of the RTS that handles memory
allocation (ghc/rts/MBlock.h).  The second of these changes *should* go
away when I figure out how best to generically handle 64-bit arches in
the MBlock code (there's already generic 32-bit support).

As a side-effect, I've written a bunch of instructions on
cross-compiling GHC for a new platform, which I'll put in the porting
section of the Building Guide.