[MLton] power pc "port"

Matthew Fluet fluet@cs.cornell.edu
Wed, 1 Sep 2004 10:26:16 -0400 (EDT)


> > The spawnve and spawnvp errors are a puzzle to me.  I don't see where in
> > the MLton code these functions are defined.  Is there a dependant library
> > that I'm not seeing?  (I can easily implement these functions, but I don't
> > want to do that if they're already out there somewhere.)
>
> As far as I can tell, we are pulling it from libc.  For most platforms, I
> suspect that whatever header file the prototypes are really in has more
> stuff than we need, so there is an explicit
>    runtime/platform/spawn.h
> that is included by linux.h, {free,net,open}bsd.h, and solaris.h,
> but cygwin.h and mingw.h get it from <process.h>.
>
> However, that doesn't explain the linker not finding the symbols.  Maybe
> they are in a different library under Mac OS X.

Let me revise this.  I think that spawnv{e,p} don't actually exist on
linux (and other unix derivatives, so probably not on Mac OS X).  On non
Windows platforms, MLton.Process.spawn* functions are supposed to simplify
down to Posix.Process.fork/exec (and hence to their underlying system
calls), so the MLton_Process_spawn{e,p} functions are not used, and hence
the linker avoids bringing them in.

There are a couple of possiblities:
1) The simplifications of MLton.Process.spawn* functions aren't being
   performed correctly.  This might happen if
   MLton.Platform.{Arch,OS}.host aren't implemented correctly.
2) The Mac OS X linker isn't handling archive libraries in the same way
   that the linux linker is.  What is supposed to happen is that when
   linking with libmlton.a, when there is no reference to
   MLton_Process_spawn{e,p} in the object file compiled by mlton (because
   they got simplified away), then the corresponding spawne.o and spawnp.o
   object files in the archive are not included.  Hence, the spawnve and
   spawnvp functions (and corresponding symbols) aren't needed/included
   in the final program, so there isn't any reason for the linker to go
   looking for them.