From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com
Subject: Re: Slow lang_insert_orphan
Date: Fri, 18 Mar 2005 15:17:00 -0000 [thread overview]
Message-ID: <20050318135532.GB21148@bubble.modra.org> (raw)
In-Reply-To: <20050318131431.GA21148@bubble.modra.org>
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
next prev parent reply other threads:[~2005-03-18 13:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-17 19:59 H. J. Lu
2005-03-18 10:45 ` Nick Clifton
2005-03-18 15:08 ` Alan Modra
2005-03-18 15:17 ` Alan Modra [this message]
2005-03-18 16:24 ` H. J. Lu
2005-03-18 20:04 ` Slow lang_output_section_find_1 H. J. Lu
2005-03-19 1:51 ` Alan Modra
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=20050318135532.GB21148@bubble.modra.org \
--to=amodra@bigpond.net.au \
--cc=binutils@sources.redhat.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).