From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id F332DBBAF for ; Thu, 3 Dec 2009 11:57:08 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEABgoF0tdurFZ/2dsb2JhbAClJ7F+hDIEgWc X-IronPort-AV: E=Sophos;i="4.47,334,1257116400"; d="scan'208";a="37902562" Received: from turin.teluna.org ([93.186.177.89]) by mail2-smtp-roc.national.inria.fr with ESMTP; 03 Dec 2009 11:57:08 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by turin.teluna.org (Postfix) with ESMTP id 0C3111C720 for ; Thu, 3 Dec 2009 11:48:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at turin.teluna.org Received: from turin.teluna.org ([127.0.0.1]) by localhost (turin.teluna.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2qMrRzNoZ9xD for ; Thu, 3 Dec 2009 11:48:40 +0100 (CET) Received: from glaurung.localnet (unknown [85.255.197.126]) (Authenticated sender: joost@damad.be) by turin.teluna.org (Postfix) with ESMTPSA id 435091C71C for ; Thu, 3 Dec 2009 11:48:40 +0100 (CET) From: Joost Yervante Damad To: caml-list@inria.fr Subject: Re: [Caml-list] Embedding the ocaml runtime in a shared library on amd64/x86_64 Date: Thu, 3 Dec 2009 11:56:59 +0100 User-Agent: KMail/1.12.2 (Linux/2.6.29-2-amd64; KDE/4.3.2; x86_64; ; ) References: <200912021333.11599.joost@damad.be> <20091202165116.GA7786@annexia.org> <20091202223751.GA20553@usha.takhisis.invalid> In-Reply-To: <20091202223751.GA20553@usha.takhisis.invalid> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912031157.00187.joost@damad.be> X-Spam: no; 0.00; ocaml:01 runtime:01 zacchiroli:01 0100,:01 -fpic:01 libcamlrun:01 bug:01 libasmrun:01 -fpic:01 libcamlrun:01 gcc:01 bug:01 2009:98 2009:98 wrote:01 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/