tuning ld performance

Andy Chittenden achittenden@bluearc.com
Mon Jan 26 09:50:00 GMT 2004


We've been using ld built for the powerpc-linux-gnu target from
binutils-2.9.5 and it takes a long time to generate an image. So I decided
to profile ld to see whether we could make things better. Rather than start
with an old version, I built a profiled version of ld for the
powerpc-linux-gnu target from binutils-2.14.90.0.7 as distributed by the
Debian project. With this version of ld, 58% of the CPU was being taken up
by _bfd_strip_section_from_output. As an experiment, I put in a return
statement just after the s->flags |= SEC_EXCLUDE, and that routine has now
gone off the radar. This change made hardly any difference to the size of
the executable but improved the time of ld significantly. Is there some way
of avoiding the call to _bfd_strip_section_from_output completely or is
there an easy way of making the nested loop at the bottom of the routine a
lot more efficient?

Secondly, after putting in the return statement, the next routine on the
radar, bfd_hash_lookup, is taking 67% of CPU. As the major callers are
_bfd_stringtab_add (from _bfd_link_section_stabs) and
_bfd_link_section_stabs itself, it seems this could be stabs related but we
obviously need them for debugging. Again, is there an easy way of either
making this routine more efficient or removing calls to it? 

I've attached the complete profiling results if anyone's interested.

-- 
Andy 



*********************************************************************
This e-mail and any attachment is confidential. It may only be read, copied and used by the intended recipient(s). If you are not the intended recipient(s), you may not copy, use, distribute, forward, store or disclose this e-mail or any attachment. If you are not the intended recipient(s) or have otherwise received this e-mail in error, you should destroy it and any attachment and notify the sender by reply e-mail or send a message to sysadmin@bluearc.com
*********************************************************************

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ld.profile.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20040126/154b8fe8/attachment.txt>


More information about the Binutils mailing list