This is the mail archive of the
mailing list for the binutils project.
Long linking time
- From: Nicolas Savoire <nicos at maunakeatech dot com>
- To: binutils at sourceware dot org
- Date: Thu, 3 Aug 2006 11:06:18 +0200
- Subject: Long linking time
I don't know if this is a gcc or ld issue, but since I updated gcc to 4.1.1
version, the linking times of the project I work on have skyrocketted. One
particular shared library, which used to link in less than a second now takes
6 minutes to link!!!! This library instantiates a lot of templates (use of
itk image library and boost).
After further investigation, it appears that disabling debug info generation
during compilation or asking ld to strip debug info (-S flag) leads to normal
linking time (~1s).
I use binutils 2.17, but versions 2.15 and 2.16 exhibit the same behaviour.
A quick profiling show that almost all the execution time is spent in qsort,
the call stack at that point looks like:
#0 elf_sort_elf_symbol (arg1=0x99e49d0, arg2=0x99eb618) at elf.c:8524
#1 0xb7eb5ddb in bsearch () from /lib/libc.so.6
#2 0xb7eb5f3a in qsort () from /lib/libc.so.6
#3 0x0809fbfc in bfd_elf_match_symbols_in_sections (sec1=0x81889e4,
sec2=0x83aa974) at elf.c:8628
#4 0x080ac0a1 in match_group_member (sec=0x83aa974, group=0x817ad2c) at
#5 0x080ac113 in _bfd_elf_check_kept_section (sec=0x83aa974) at
#6 0x080acca0 in elf_link_input_bfd (finfo=0xbffe0684, input_bfd=0x81528c0)
#7 0x080af013 in bfd_elf_final_link (abfd=0x8133128, info=0x8126920) at
#8 0x0805f39f in ldwrite () at ldwrite.c:557
#9 0x0805c6ec in main (argc=82, argv=0xbffe0914) at .././ld/ldmain.c:468
I had already posted a message about this issue, but it remains without
answer. I hope this more descriptive version will help.