[MLton] Re: r6701

Wesley W. Terpstra wesley at terpstra.ca
Tue Aug 19 09:43:39 PDT 2008


On Tue, Aug 19, 2008 at 7:15 PM, Matthew Fluet <fluet at tti-c.org> wrote:

> On Tue, 19 Aug 2008, Wesley W. Terpstra wrote:
>
>> I don't have a i386 with osx, but I gather from this checkin that .hidden
>> doesn't work. Could someone try ".private_extern" instead?
>>
>
> ".private_extern" seems to work for '-format archive'.
> But, with '-format library', I get:
>
> [fluet at fenrir temp]$ ../mlton.git-svn.trunk/build/bin/mlton -default-ann
> 'allowFFI true' -export-header foo.h -format library -keep g -keep o
> -verbose 2 foo.sml
> ...
>   Link starting
>      gcc -o foo.dylib -dynamiclib foo.1.o foo.0.o \
>          -L/Users/fluet/devel/mlton/mlton.git-svn.trunk/build/lib/self \
>          -lmlton-pic -lgdtoa-pic -lm -lgmp -L/usr/local/lib
> -L/opt/local/lib
> ld: foo.0.o has local relocation entries in non-writable section
> (__TEXT,__text)
> /usr/libexec/gcc/i686-apple-darwin8/4.0.1/libtool: internal link edit
> command failed
>   Link raised in 0.06 + 0.00 (0% GC)
> MLton raised in 0.23 + 0.00 (0% GC)
> call to system failed with exit status 1:
> gcc -o foo.dylib -dynamiclib foo.1.o foo.0.o
> -L/Users/fluet/devel/mlton/mlton.git-svn.trunk/build/lib/self -lmlton-pic
> -lgdtoa-pic -lm -lgmp -L/usr/local/lib -L/opt/local/lib


That's because the i386 assembly isn't PIC, and osx requires PIC libraries
(unlike linux) <
http://hackage.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode>.
Grrrr.

A text relocation is where the linker records what locations of the code
need to be changed after loading a library. I was hopeful I wouldn't need
PIC for i386. :-(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20080819/46ec322c/attachment.htm


More information about the MLton mailing list