caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Dawid Toton <dawid.toton@uj.edu.pl>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Incremental linking
Date: Wed, 30 Sep 2009 10:08:02 +0200	[thread overview]
Message-ID: <4AC311E2.7030409@inria.fr> (raw)
In-Reply-To: <4AC25433.1060709@uj.edu.pl>

Dawid Toton wrote:
> I have lot of modules and they are compiled to native code.
> So I have .cmx and .o files and want to link them faster.
> Is is possible to make linking an associative operation acting on modules?
> [...]
> Documentation of ld says that files produced with --relocatable can be 
> used as intermediate partially linked files. Can something like this be 
> done with object code produced by ocamlopt?

Yes.  "ocamlopt -pack" actually calls "ld -r" underneath to
consolidate several compilation units in a single .cmx/.o file.
"ld -r" will resolve references between these compilation units.

Gerd Stolpmann wrote:
> Well, you can link several .cmx files (and their accompanying .o files)
> to a .cmxa file (and an accompanying .a file): ocamlopt -a

 From a linking standpoint, "ocamlopt -a" is equivalent to "ar": it
does not resolve any references, just concatenates individual
.cmx/.o files in a single .cmxa/.a file.   That can still speed up
linking a bit, since reading one big .a file is faster than reading a
zillion small .o files.

Generally speaking, I'm somewhat surprised that linking time is an
issue for Dawid.  Modern Unix linkers are quite fast, and the
additional link-time work that OCaml does is small.  Let us know if
you manage to narrow the problem.

- Xavier Leroy


  reply	other threads:[~2009-09-30  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-29 18:38 Dawid Toton
2009-09-30  8:08 ` Xavier Leroy [this message]
2009-10-12 14:36   ` Dawid Toton
2009-09-29 18:39 Dawid Toton
2009-09-29 21:08 ` [Caml-list] " Gerd Stolpmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AC311E2.7030409@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=dawid.toton@uj.edu.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).