Linking large D programms

Torsten Sommerfeld Globe13.Trotter17 at gmx.de
Sat May 1 23:33:26 PDT 2010


Thank you for your answers.
I have really managed to improve the linking speed:

First I have tried to use the GOLD linker. Because I am using ubuntu, the package
was available in the sources. But now, because I do not know the binutils and I
could not find a useful documentation I do not know if I am using it now or not. I
guess yes, because ld-- version gives "GNU gold (GNU Binutils for Ubuntu 2.20) 1.9"
Nevertheless it did not help to reduce linking time.

You have mentioned the -of command flag. For dmd there is no documentation about
it in the help so I could not make it work.

However during my try and error to use it I figured out that my guess how dmd
links was not correct.

It seems, that if the -c option is used (no linking) then for each .d file an .o
file is created. However if the -c flag is not giving, only one .o file is created.

I got to recognize that the output speed (-v flag) became extremely slow when -c
was not used I wondered how this can be, because linking was not supposed to be
done at that particular time anyway.

After I have managed to separate compiling and linking (calling dmd with -c and
then calling gcc with all object files and libraries) I could see that linking 250
Object files took 1 second! (Compared to 20 min if dmd does the job).

So my guess is, that creating the one object file (not using -c) during compiling
is very inefficient - and in consequence I have unfairly blamed the the linker for it.

Torsten



More information about the Digitalmars-d mailing list