Version française
Home     About     Download     Resources     Contact us    
Browse thread
Dynamic libs w/ Ocaml + C code under Mac OS X
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] Dynamic libs w/ Ocaml + C code under Mac OS X
Joel Stanley wrote:
> ld -bundle -flat_namespace -undefined suppress -read_only_relocs 
> suppress -o 'foo.so'  '-L/Users/jstanley/hbin/lib/ocaml' 
> 'foo.so.startup.o' 'simple.o' '/Users/jstanley/hbin/lib/ocaml/stdlib.a' 
> 'wrapper.o' '/Users/jstanley/hbin/lib/ocaml/libasmrun.a'
> 
>  > ld: absolute addressing (perhaps -mdynamic-no-pic) used in 

Ok, it makes sense. Now, if you replace ld with ld_classic, does it work?

>  From the experiments that I've been doing, it really looks like PIC 
> needs to be generated for the OS X linker to be happy.  Do you have any 
> assessment as to how much work this is?  Keep in mind that I don't 
> consider myself an x86 assembly hacker by any stretch of the imagination 
> ;)  I'd really like to just run this natively on my main platform, but 
> if I can't, I can't.

Honestly, I don't know how hard it would be. You can look at what had to 
be done for AMD64 
(http://camlcvs.inria.fr/cgi-bin/cvsweb/ocaml/asmcomp/amd64/) and at how 
one is supposed to produce PIC for x86 (gcc -fPIC).

Or you can try to convince Apple to restore "-read_only_relocs
suppress" in the new linker (I could find no indication that Apple 
deliberately dropped this feature).

-- Alain