[MLton] ppc64?

Matthew Fluet fluet at tti-c.org
Thu Sep 27 07:38:04 PDT 2007


On Thu, 27 Sep 2007, Adam Goode wrote:
> The GCC regression in Fedora has finally been fixed, and I am going to
> build for ppc again. Fedora 7 and 8 also include the ppc64 architecture
> (provided by, among other things, PlayStation 3). Do you know if I can
> bootstrap ppc64 with the ppc MLton binaries? Otherwise, I will have to
> try to make a ppc64 MLton binary even though I don't have the hardware.

I don't think that MLton will support ppc64 without some (minor) 
modifications. <src>/basis-library/mlton/platform.{sig,sml} and 
<src>/bin/platform don't distinguish between PowerPC and other ppc* 
architectures.  It should be relatively straightforward to add (though 
having access to the hardware would make things a lot easier).  The 
documentation from
   http://mlton.org/PortingMLton
   http://mlton.org/CrossCompiling
has pointers on how to go about doing so.  But, they assume that you can 
run on the target hardware.  Nonetheless, you could try crafting 
appropriate patches and throw the Fedora autobuilders at it, rinse and 
repeating after looking at the build logs.

I'm assuming that ppc64 has a compatability mode for running ppc binaries 
(similar to x86_64 having a compatability mode for running x86 binaries). 
Also, I'm assuming that the gcc/binutils toolchain on ppc64 is capable of 
producing ppc binaries via a simple -m32 flag (again, similar to x86_64).

See
   http://mlton.org/pipermail/mlton/2007-June/029848.html
for some more details on building between architectures.  I think that the 
2b option is the most appropriate in this instance.  That is, you'll want 
to patch
  <src>/bin/mlton-script
and add
        -target-as-opt powerpc '-m32' \
        -target-cc-opt powerpc '-m32' \
        -target-link-opt powerpc '-m32' \
        -target-as-opt powerpc64 '-m64' \
        -target-cc-opt powerpc64 '-m64' \
        -target-link-opt powerpc64 '-m64' \
Rebuild the ppc arch rpm.  Now build the ppc64 arch rpm with a dependency 
on the ppc arch rpm (and the 32-bit compatability toolchain).  The first 
round of compiling will use the ppc executable/runtime-library to yield a 
ppc executable (because it passes -m32 to gcc); the second round of 
compiling will use the ppc executable but yield a ppc64 executable.

The same process should have worked to bootstrap the amd64 arch from the 
x86 arch.  (Though I see from the Koji build logs that you used the 
mlton-20070826-1.amd64-linux.tgz.)



More information about the MLton mailing list