--- Additional Comments From matz at suse dot de 2006-04-24 14:33 ---
Btw, HJ: your patch to revert Alans also makes ld quite slow on huge
testcases. I put a tarball on http://www.suse.de/~gcctest/slowld.tar.gz .
link command:
% g++ -g -o ff3d trapFPE.o main.o FFThread.o StaticCenter.o
language/libfflanguage.a solver/libffsolve.a language/libpovlanguage.a
geometry/libffgeometry.a algebra/libffalgebra.a utils/libffutils.a -pthread
This will take from five to ten minutes to link depending on the machine.
These are i386 .o and .a files.
The problem is that _bfd_elf_check_kept_section is N^2 in the number of
sections, and furthermore does repeatedly the same work over and over again
(e.g. sorting all symbols of a BFD over and over). Not having PRETEND in
action completely avoids this work here (though of course the N^2 problem
still is there). This reduces link time to about 2 to 3 seconds.
We were trying to work-around this by noting that the
_bfd_elf_check_kept_section() function basically is const, i.e. given
the same discared input section it will give the same result every time.
Hence we can remember it in struct bfd_section or in the ELF specific part
of a section. That still leavs multiple sorts over the same set of
symbols for each BFD (one time for each section needing that handling).
Then ld needs only 17 seconds, which still is much better.
When I saw that this actually was not a problem in FSF binutils, but only
in your version I stopped making the patch pretty for submission, so I
add it here only for demonstration what I mean:
--
@@ -7512,7 +7438,13 @@ elf_link_input_bfd (struct elf_final_lin
{
asection *kept;
- kept = _bfd_elf_check_kept_section (sec);
+ if (sec-hack_foo == NULL)
+ {
+ sec-hack_foo = _bfd_elf_check_kept_section
(sec);
+ }
+ if (sec-hack_foo == NULL)
+ sec-hack_foo = (void*)-1;
+ kept = sec-hack_foo == (void*)-1 ? NULL :
sec-hack_foo;
if (kept != NULL)
{
*ps = kept;
-
Probably can't be applied due to white-space changes. Also add a 'hack_foo'
member to asection ;-) Perhaps you might use that idea in your reversal
patch to make HJ binutils not as slow.
Another thing I noticed while reading the code is some obvious funnyness
in match_group_member(), which read like so:
match_group_member (asection *sec, asection *group)
{
asection *first = elf_next_in_group (group);
asection *s = first;
while (s != NULL)
{
if (bfd_elf_match_symbols_in_sections (s, sec))
return s;
if (s == first)
break;
}
return NULL;
}
This obviously was designed to loop over all sections in a section group,
when provided with one. The loop structure and use of elf_next_in_group
indicate this. But this loop actually doesn't iterate, as s never
is changed.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=2342
--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils