[MLton] Re: power pc "port"

mikel mikel@evins.net
Tue, 31 Aug 2004 20:54:47 -0700


Filip Pizlo wrote:
>>OK.  It just seems to be a more challenging approach because you're
>>trying to solve two problems at once: compiling for Darwin/PowerPC and
>>compiling a huge program (MLton).  Plus you have to fight the fact
>>that you're using a really slow compiler (MLton compiled by SML/NJ).
>>It's easier to first get compiling for Darwin/PowerPC right, using a
>>fast compiler (MLton compiled by MLton), and then tackle huge programs
>>and self compilation.  But, you do have to learn the upgrade-basis
>>stuff sometime :-).
> 
> 
> I just wanted to update everyone on the status of the PowerPC port.  Right
> now, I've got a MLton compiled MLton (compiled on Luke's Linux box) almost
> linking on Mac OS X.  Mac OS X has a bizarre linker, so I am not
> expecting this step to be particularly pleseant.  Anyway, here are the
> current errors:
> 
> ld: warning multiple definitions of symbol _main
> mlton.0.o definition of _main in section (__TEXT,__text)
> ../runtime/libgdtoa.dylib(single module) definition of _main
> ld: warning multiple definitions of symbol _strtod
> ../runtime/libgdtoa.dylib(single module) definition of _strtod
> /usr/lib/libSystem.dylib(gdtoa-strtod.So) definition of _strtod
> ld: warning multiple definitions of symbol _strtof
> ../runtime/libgdtoa.dylib(single module) definition of _strtof
> /usr/lib/libSystem.dylib(gdtoa-strtof.So) definition of _strtof
> ld: Undefined symbols:
> _IEEEReal_getRoundingMode
> _IEEEReal_setRoundingMode
> _spawnve
> _spawnvp
> _etext
> 
> The multiple defintion problems are because Mac OS X's libSystem
> (equivalent of libc) uses the gdtoa library.  However, it doesn't export
> the gdtoa symbol.  So we may just have to live with these warnings (there
> is a switch somewhere to suppress them).
> 
> The IEEEReal_getRoundingMode and IEEEReal_setRoundingMode errors are
> an oversight - I'll have to hack runtime/basis/IEEEReal.c to have a
> PowerPC case.
> 
> 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.)
> 
> The etext error may turn out to be annoying.  The MLton GC uses the _start
> and etext symbols to figure out where the text segment sits.  
> Unfortunately, the Mac OS X linker doesn't offer an etext symbol.  It
> does, however, offer functions that give similar information: get_etext(),
> get_end(), and get_edata().  However, the manual page (see
> http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/end.3.html)
> makes clear that you're not really supposed to rely on those.  Perhaps if
> a MLton GC expert could tell me exactly how etext is used, I can hack the
> GC to be more Mac OS X-friendly.

Just thought I;d send a message to make sure you know that potential 
users are looking forward to your success.