From: Alan Modra <amodra@bigpond.net.au>
To: Nicolas Savoire <nicos@maunakeatech.com>
Cc: binutils@sourceware.org
Subject: Re: Long linking time
Date: Thu, 03 Aug 2006 10:27:00 -0000 [thread overview]
Message-ID: <20060803102656.GA22906@bubble.grove.modra.org> (raw)
In-Reply-To: <200608031106.18705.nicos@maunakeatech.com>
On Thu, Aug 03, 2006 at 11:06:18AM +0200, Nicolas Savoire wrote:
> 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
> elflink.c:6778
> #5 0x080ac113 in _bfd_elf_check_kept_section (sec=0x83aa974) at
> elflink.c:6802
> #6 0x080acca0 in elf_link_input_bfd (finfo=0xbffe0684, input_bfd=0x81528c0)
> at elflink.c:7155
> #7 0x080af013 in bfd_elf_final_link (abfd=0x8133128, info=0x8126920) at
> elflink.c:8266
> #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.
This is a ld problem. We are paying a high price for some checks that
HJ added to validate linkonce/comdat sections. I approved at least some
of the patches so I share some blame too. HJ has posted some patches to
improve time spent in _bfd_elf_check_kept_section, but they haven't been
applied yet to FSF binutils. I'm not too keen on approving them because
I think they are just bandaids, and the real fix is to revert the symbol
matching code.
You might like to try compiling HJ's latest release from
ftp.kernel.org/pub/linux/devel/binutils/ which I assume has HJ's
bandaids applied. Please report the link times vs mainline binutils
back here, with and without -g.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
next prev parent reply other threads:[~2006-08-03 10:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-03 9:05 Nicolas Savoire
2006-08-03 10:27 ` Alan Modra [this message]
[not found] <fa07ec106fac0cf7b83a0ef82922ccca44f2eb46@locuspharma.com>
2006-08-28 15:56 ` Nicolas Savoire
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060803102656.GA22906@bubble.grove.modra.org \
--to=amodra@bigpond.net.au \
--cc=binutils@sourceware.org \
--cc=nicos@maunakeatech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).