From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id F0051820A1 for ; Tue, 10 Sep 2013 18:15:28 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of adrien@notk.org) identity=pra; client-ip=91.121.71.147; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="adrien@notk.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of adrien@notk.org designates 91.121.71.147 as permitted sender) identity=mailfrom; client-ip=91.121.71.147; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="adrien@notk.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@nautica.notk.org) identity=helo; client-ip=91.121.71.147; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="postmaster@nautica.notk.org"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgYFAGlEL1JbeUeT/2dsb2JhbABbgweEM78WgSUWdIIlAQEFI1YQCxgCAgUTDgICDwUYRIgGri2RT4EpjjIHFoJTNIEAA5d1AZFrgyI6 X-IPAS-Result: AgYFAGlEL1JbeUeT/2dsb2JhbABbgweEM78WgSUWdIIlAQEFI1YQCxgCAgUTDgICDwUYRIgGri2RT4EpjjIHFoJTNIEAA5d1AZFrgyI6 X-IronPort-AV: E=Sophos;i="4.90,879,1371074400"; d="scan'208";a="32309142" Received: from nautica.notk.org ([91.121.71.147]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 10 Sep 2013 18:15:28 +0200 Received: by nautica.notk.org (Postfix, from userid 1003) id 95F99C009; Tue, 10 Sep 2013 18:15:27 +0200 (CEST) Date: Tue, 10 Sep 2013 18:15:27 +0200 From: Adrien Nader To: oleg@okmij.org Cc: alain@frisch.fr, Xavier.Leroy@inria.fr, caml-list@inria.fr Message-ID: <20130910161527.GA11953@notk.org> References: <522D8605.1050603@frisch.fr> <20130910020157.41613.qmail@www1.g3.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20130910020157.41613.qmail@www1.g3.pair.com> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Accelerating compilation On Tue, Sep 10, 2013, oleg@okmij.org wrote: > The real problem in my view is the strange decision to load shared > libraries at link time and force the resolution of their undefined > references. This decision certainly makes linking slower, without > providing much benefit, it seems. After all, if the resolution > succeeded at link time, it may still fail at run time since the > linked executable can be run in a different location or even a > different computer. > > So, the real problem to me is ocamlc using RTLD_NOW flag when loading > shared library. Removing the flag would make linking faster, and less > painful. > > A few technical details: dlopen with the problematic flag occurs in > the function caml_dlopen in the file byterun/unix.c > > void * caml_dlopen(char * libname, int for_execution, int global) > { > return dlopen(libname, RTLD_NOW | (global ? RTLD_GLOBAL : RTLD_LOCAL) | RTLD_NODELETE); > /* Could use RTLD_LAZY if for_execution == 0, but needs testing */ > } > > That function caml_dlopen is used within caml_dynlink_open_lib, > which, under alias dll_open, is called in Dll.open_dll. The latter > function is invoked in Bytelink.link_bytecode. That completely breaks for cross-compilation. No matter how hard you try, you're going to have troubles loading a PE32 shared library from your ELF executable (and even more if you try to load AArch64 on MIPS). :) And of course, right now I can't find what I've done for that. I guess I'll have to find again soon though. -- Adrien Nader