Version française
Home     About     Download     Resources     Contact us    
Browse thread
Incremental linking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dawid Toton <d0@w...>
Subject: Re: Incremental linking
> 
> 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.

I tried with this switch and indeed I can link a toy program by
arbitrary intermediate steps. It works OK and is good news to me.

Since today I thought that I have no way to generate the startup code
quickly, but I came to the following solution:
ocamlopt -o prog -dstartup --cc echo A.cmx B.cx C.cmx D.cmx
as -o prog.startup.o prog.startup.s

This way I have all the technical pieces working. Now I have to think
how to automate this. :)

> 
> 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.

My interest in this comes from combination of few facts: all my
calculations are done on a not very fresh machine, my code is a big tree
of small modules and I normally work this way:
1. modify some module (usually at leaf position)
2. recompile everything to native code
3. run, look at the results and go to 1.

I need therefore fast recompilation and fast linking (to stay focused on
the work). I'm about to solve the problem of ocamlbuild spending all its
time looking at unmodified modules. Then I wanted to make sure that it
will be possible to mitigate the second bottleneck.

This is why I'm happy to be able to do incremental linking.

It's helpful that the ocamlopt itself is very fast.

Dawid