[MLton] Operton AMD64

Ray Racine rracine@adelphia.net
Sun, 02 Jan 2005 21:23:22 -0500

On Sun, 2005-01-02 at 17:25 -0800, Stephen Weeks wrote:

> I haven't heard about anyone running on that.  Please tell us what you
> learn.

I only got it to C codegen several weeks back.  Since I've never written
even a hello world program in C it must not have been that difficult.

Mainly tricking the scripts to treat all the amd64, uname  stuff to
return the expected x86 and I just peppered around -mtune=opteron -m32
in all the right places.

Being the new year and all I of course reformatted my laptop to FC3 this
weekend. So I'm starting over. :(

Once I get back to C codegen working I'll get the regular native/asm
codegen to work.

Trouble spots.

I ran into the hardcoded -lgmp stuff in main.fun and was somehow able to
do a little trick to get it to work which CURRENTLY I ESCAPES ME and its
driving me NUTS.  Sorry... I did something in about 2 mins before that I
can't reproduce in the last 30 mins.

Now I get:

/usr/bin/ld: skipping incompatible /usr/lib64/libgmp.so when searching
for -lgmp
/usr/bin/ld: skipping incompatible /usr/lib64/libgmp.a when searching
for -lgmp
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status
call to system failed with exit status 1:
gcc -o hello /tmp/fileXaAUZI.o /tmp/fileECXZdd.o -L/usr/lib/mlton/self -
lmlton -lgmp -m32 -lgmp -lgdtoa -lm

Why it refuses to pickup the /usr/lib/libgmp.so (the 32 bit gmp) is just
damn odd.  I put manual -L/usr/lib/  and even dropped a copy
in .../mlton/self.  Anyway I'll remember what I did in a bit.

The other problem that stopped me from proceeding onwards to get the
native compile working was having to get into main.fun to 
1) mess with the hardcode stuff regarding gmp et al.
2) adding the ability to pass options to the linker when using native
compile from what I say was not available.  (you can passed args to gcc
when C compiling and linking just fine via the compile-mlton script.)

The reason I stopped was because there was a lot of action going on
about then with the 64 sparc hppa stuff and I saw some emails regarding
cleaning up the gmp stuff.  So I figured to hold off a bit till the CVS
check dust settled and you guys could get most of the work done for
me :). I haven't really looked at the latest main.fun to see what
adjustments were made.

Anyway. Currently I am just trying (again!) to get MLton self hosting on
the Opteron compiling as a 32 bit app using C codegen, then with a bit
of hacking in main.fun native gen should work.  ( some of Opcode such as
push are not compiling as 64 bit and then later fails...  all I got to
do is get a darn -m32 option to it and all should go fine.)