Crosscompiling
Stephen Weeks
MLton@sourcelight.com
Tue, 18 Sep 2001 13:29:19 -0700
> But the assembler still complains, because it tries
> to use the cross-assembler.
I assume this is all still while trying to compile the "lookup-constants" file?
> So I probably need to pass
> the option -Bprefix=/usr/bin to gcc. But it seems that
> there is no longer a way to pass options to gcc
> (as in the old days? :) Is there any good way that
> I can pass this flag to gcc by just modifying the
> scripts?
Blech. Looking at src/mlton/main.sml I see that the switches that appear before
the "END" in bin/mlton are only used by the C backend, so there is no way to do
what you want via the script.
> I'm also not sure if setting gcc='/usr/bin/gcc' only
> affects precompilation or if it also affects the use
> of the C-backend.
It affects all calls to gcc made by MLton. This includes
* lookup-constants
* C backend
* the single C file generated by the native backend
(used to pass some info to the runtime)
For a crosscompiler, we're going to need two different ways to call gcc.
1) For lookup-constants, use the gcc for the source machine
2) For the C backend and the C file generated by the native backend, use the
gcc for the target machine.
The right way to do this seems to me to include the ability to pass two sets of
switches from within the bin/mlton script. You can do this by adding another
tag like END, and modifying main.sml to pass along the appropriate set of
switches in each call to docc. I think that basically the current use assumes
that everything if for the target machine, so that the easiest fix is to have
the new set of switches specify the source machine, which is only used for
lookup-constants. Then, you only need to change the behavior of the docc that
is passed to Compile.compile.
Let us know how this works or if you need more hints.