incremental linking?

Wed, 27 Nov 2002 11:32:14 +0000

> Hmm, I've never heard of linking being a bottleneck.  Even GHC itself
> links in about 3-4 seconds here.  One common problem is that linking on
> a network filesystem takes a *lot* longer than linking objects from a
> local disk.  It's always a good idea to keep the build tree on the local
> disk, even if the sources are NFS-mounted.

Unfortunately, we're not talking seconds, but coffee-breaks of
linking times on our Sun (yes, the stuff is in the range of a large
compiler - we're fortunate enough to be able to build on rather
substantial third-party packages, think haskell-in-haskell frontend
distributed over unusually many modules + strategic traversal
support + our own code). 

And yes, I was worried about NFS-mounting first, especially since
linking on our Sun takes even longer than on our PCs (long breaks
instead of short ones;-), but moving .hi and .o to local tmp-space
didn't speed things up (then again, it's a large machine, and our
disk setup is likely to be more complex than I know - I'll have to
check with our admins).

> > Alternative a: use someone else's incremental linker, e.g., Sun's
> > ild (ghc's -pgml option appears to have its own idea about option
> > formatting, btw) - this doesn't seem to work - should it?
> You'd probably want to call the incremental linker directly rather than
> using GHC - what exactly does it do, BTW?  What files does it generate?

Calling it via GHC seemed the best way to ensure that it gets
everything it needs (what else would be the purpose of -pgml?).

According to docs, ild just keeps more information and space in the
linked object, so that on re-linking, it can (a) check for
file-modification times and (b) replace and partially relink only
those contributing objects that have changed.

> > Alternative b: convince ghc to link objects in stages, e.g., on a
> > per-directory basis - gnu's ld seems to support at least this kind
> > of partial linking (-i/-r). Not quite as nice as a fully incremental
> > linker, but would probably save our day..
> Yes, this works fine.  We use it to build the libraries for GHCi.

Presumably directed via Makefiles? 
Could this please be automated for ghc --make?