This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Speeding up linking.


Hello! Lately i've been doing some research to find out how to improve
gcc linking speed. I noticed that gcc can take up to 20 times more (with 2.95, 
up to 40 with 3.2) to link when -g flag is enabled.
On a small/medium project, this can take up to 1/2 minutes.
As far as I understand, linking speed doesnt
seem have much to do with cpu usage but disk usage (cpu remains at 0 when
linking). If I disable -g, linking only takes around a few seconds.

Since i'm still not at the point of investigating at source level, i did
some tests using ramdisks for: libraries, object files, etc. The result
was that if i throw all the .a files (which with -g enabled take around 200 mb)
into a ramdisk, linking only takes 2/3 seconds. I concluded that, as
far as things are, the slowness of linking seems to be limited to disk read speed?

I also investigated the approach used by microsoft on CL. They seem to dump
all debug symbols to a .PBD (program database) file , thus making the final
link a lot faster, even when debug information. GDB seems to have
an option to load symbols from a file by using "-s" So i wonder
if there is an option in GCC to also create a separate
symbol table file. Do you think this can be done in gcc? And do you
think it's worth it?

I also considered just using dynamic libraries, this would leave
the symbol matching job to the dynamic linker, but i'm not sure
if this is faster on most platforms.

Thanks in advance for reading this.


Juan Linietsky




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]