English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Native compilation for today's MIPS
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-08-10 (17:34)
From: rixed@h...
Subject: Native compilation for today's MIPS

I'm trying to make ocaml native compiler works on a Loongson2F processor
with a GNU/Linux system.

So far, I managed to work around many ABI related issues (I want n32 ABI,
because from the configure script it seams closest from the old MIPS
assembly emmiter and because "the Internet" thinks it's faster than o32).

So, after some minor changes I got ocamlopt and ocamlopt.opt, but the
make opt.opt command fails while compiling camlp4 (or sometime the debugger,
depending on compilation flags) :

../ocamlopt.opt -nostdlib  -c -g -I camlp4 -I stdlib -o camlp4/Camlp4_import.cmx camlp4/Camlp4_import.ml
Fatal error: exception Invalid_argument("index out of bounds")

whatever OCAMLRUNPARAM settings I try, I have no backtrace. So to
figure out where this is comming from I tried gdb but with not much luck :

This GDB was configured as "mips64el-unknown-linux-gnu"...
(gdb) b caml_array_bound_error
Breakpoint 1 at 0x1016d708: file fail.c, line 192.
(gdb) r
Starting program: ocamlopt.opt -nostdlib -I ../stdlib -c -g -I camlp4 -I stdlib -o camlp4/Camlp4_import.cmx camlp4/Camlp4_import.ml

Breakpoint 1, caml_array_bound_error () at fail.c:192
192       if (! array_bound_error_bucket_inited) {
(gdb) bt
#0  caml_array_bound_error () at fail.c:192
#1  0x1016cff8 in caml_c_call () at mips.s:192
Backtrace stopped: frame did not save the PC

Now I'm running out of ideas.
I have cleared all gcc warnings about ABI mismatch but I suspect something
is still wrong in this area. Being new both to Mips and to OCaml does not help,

So I humbly request for any pointers or ideas about what to look for.

Also, I have to say these flawed ocamlopt and ocamlopt.opt compilers can
actually compile my own poor production of ML programs, which then appear
to run normaly, so Im lacking ML programs of intermediate "difficulty"
to experiment. Is there a test suite somewhere I could use to test the
compiler ? Should I test some particular language construct in particular ?
What's your opinion ?