[PATCH] Reduce ARM linking time
Jie Zhang
jie@codesourcery.com
Fri Mar 19 16:08:00 GMT 2010
We encountered an problem with ARM ld that the linking time of a large
application was very long, about 1.5 hour.
The root cause of this issue is ARM uses a double link list to track
sections with ARM specific section data allocated. Below is the related
comment:
/* Unfortunately we need to keep a list of sections for which
an _arm_elf_section_data structure has been allocated. This
is because it is possible for functions like elf32_arm_write_section
to be called on a section which has had an elf_data_structure
allocated for it (and so the used_by_bfd field is valid) but
for which the ARM extended version of this structure - the
_arm_elf_section_data structure - has not been allocated. */
When ARM specific section data for a particular section is needed, the
*whole* list is traversed to verify if that section is in the list, i.e.
it has ARM specific section data allocated. For large applications with
tens of thousands of sections, the traverse time becomes extremely long.
This was used to fix:
http://sourceware.org/bugzilla/show_bug.cgi?id=1147
This patch uses is_arm_elf, as Paul and Dan suggested, to decide if this
section has an _arm_elf_section_data. We also need to set mapcount to -1
in elf32_arm_write_section to distinguish the two cases: no mapping
symbols (mapcount == 0) vs mapping symbols have been consumed (mapcount
== 1). Otherwise, the bug mentioned in
http://sourceware.org/ml/binutils/2010-02/msg00018.html
would come out and bite us again.
Ld regression testing with arm-none-linux-gnueabi is OK.
OK to commit?
--
Jie Zhang
CodeSourcery
(650) 331-3385 x735
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-arm-fix-linking-forever.diff
Type: text/x-patch
Size: 6112 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100319/ae538463/attachment.bin>
More information about the Binutils
mailing list