Version française
Home     About     Download     Resources     Contact us    
Browse thread
Embedding the ocaml runtime in a shared library on amd64/x86_64
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joost Yervante Damad <joost@d...>
Subject: Re: [Caml-list] Embedding the ocaml runtime in a shared library on amd64/x86_64
On Wednesday 02 December 2009 23:37:51 Stefano Zacchiroli wrote:
> On Wed, Dec 02, 2009 at 04:51:16PM +0000, Richard Jones wrote:
> > On Wed, Dec 02, 2009 at 01:33:11PM +0100, Joost Yervante Damad wrote:
> > > I think compiling with -fPIC by default on the amd64/x86_64 arch
> > > would be a good start to making it more usable for embedding.
> >
> > I think this is also a very good idea.
> 
> Seconded.
> 
> > We went through this already with libcamlrun.a:
> > http://caml.inria.fr/mantis/view.php?id=3866
> 
> Just to clarify a bit more for who did not follow that bug: what we did
> there was not precisely what Joost asked for (i.e. build libasmrun.a
> with -fPIC). Rather the patch offers two different libraries:
> libcamlrun.a (no -fPIC) and libcamlrun_shared.so (-fPIC). The reason was
> a performance penalty in using the -fPIC version.

Reading up on this, I don't think using -fPIC on amd64 has a performance 
penalty since it has the %rip register. Also it appears that gcc by default 
uses indirect addressing via %rip in the generated asm.

> Both in Debian and Fedora package you now have both libraries.
> 
> That said, I share Rich's suggestion: please file a bug (with patch
> would be even better :)), that enable building 2 different versions of
> libcamlrun, one built with -fPIC, the other as it is now.

I'm first working out the details for a larger application to make sure that 
also works.
I'll file a bug when I have a fully working solution.

greetings, Joost Damad

-- 
Joost Yervante Damad - http://damad.be/joost/