Slow lang_insert_orphan
Alan Modra
amodra@bigpond.net.au
Fri Mar 18 15:17:00 GMT 2005
On Fri, Mar 18, 2005 at 11:44:31PM +1030, Alan Modra wrote:
> after all orphans have been added. Hmm, probably the best thing would
> be to save output_bfd->section_tail before adding the orphan. Then you
> know how to unlink the orphan without looking through the list. (I
> think the orphan code predated the section hash table and section_tail.)
Committing to mainline.
* ldlang.c (lang_insert_orphan): Use old section_tail rather than
traversing the bfd section list to find pointer to new section.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.175
diff -u -p -r1.175 ldlang.c
--- ld/ldlang.c 17 Mar 2005 16:20:19 -0000 1.175
+++ ld/ldlang.c 18 Mar 2005 13:50:24 -0000
@@ -818,6 +818,7 @@ lang_insert_orphan (lang_input_statement
etree_type *load_base;
lang_output_section_statement_type *os;
lang_output_section_statement_type **os_tail;
+ asection **bfd_tail;
/* Start building a list of statements for this section.
First save the current statement pointer. */
@@ -871,6 +872,7 @@ lang_insert_orphan (lang_input_statement
os_tail = ((lang_output_section_statement_type **)
lang_output_section_statement.tail);
+ bfd_tail = output_bfd->section_tail;
os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL,
load_base, 0);
@@ -902,7 +904,7 @@ lang_insert_orphan (lang_input_statement
if (after != NULL && os->bfd_section != NULL)
{
- asection *snew, **pps;
+ asection *snew;
snew = os->bfd_section;
@@ -929,9 +931,8 @@ lang_insert_orphan (lang_input_statement
place->section = &output_bfd->sections;
/* Unlink the section. */
- for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
- continue;
- bfd_section_list_remove (output_bfd, pps);
+ ASSERT (*bfd_tail == snew);
+ bfd_section_list_remove (output_bfd, bfd_tail);
/* Now tack it back on in the right place. */
bfd_section_list_insert (output_bfd, place->section, snew);
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list