Linking large D programms

Robert Clipsham robert at octarineparrot.com
Sat May 1 04:17:57 PDT 2010


On 01/05/10 09:48, Torsten Sommerfeld wrote:
> Hello,
>
> I have a problem creating executables from more than 100 d modules (under
> linux). DMD compiles even 300 files in seconds but the linking step takes
> several minutes. It is clear that the linker has do handle an enormous amount
> of symbols so it needs the time.
> However it is hardly acceptable on the long run.
>
> Are there some alternative linkers to replace ld? Is there an incremental
> linker which can be used?
>
> If I cannot find a solution for this problem I fear I have to convert my
> project to Java (my D code looks almost like Java code) wher this "limitation"
> is not there.
> I do not like Java much and converting is a painful lot of work but as it is I
> cannot continue with D.
>
> Does anyone have any ideas?
>
> - Torsten

I hear GOLD is destined to replace ld, and is supposedly far faster. 
Your distro might have a repository for it, if not you'll have to 
compile it from source. It might also be worth profiling (go)ld while 
it's linking, and seeing where it's spending the most time. If it's 
spending a lot of time reading object files then the solution would be 
to combine some object files into one before invoking the linker, eg 
using dmd's -lib switch or passing all the files at once and using -of 
foo.o so only one object file is produced.



More information about the Digitalmars-d mailing list