* ldlang.c (lang_insert_orphan): Use old section_tail rather than

traversing the bfd section list to find pointer to new section.
This commit is contained in:
Alan Modra 2005-03-18 13:56:26 +00:00
parent 554220db5b
commit 41c7ba7cc2
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2005-03-19 Alan Modra <amodra@bigpond.net.au>
* ldlang.c (lang_insert_orphan): Use old section_tail rather than
traversing the bfd section list to find pointer to new section.
2005-03-18 Alan Modra <amodra@bigpond.net.au> 2005-03-18 Alan Modra <amodra@bigpond.net.au>
* scripttempl/elf.sc: When CREATE_SHLIB, put .sdata2 and .sbss2 * scripttempl/elf.sc: When CREATE_SHLIB, put .sdata2 and .sbss2

View file

@ -818,6 +818,7 @@ lang_insert_orphan (lang_input_statement_type *file,
etree_type *load_base; etree_type *load_base;
lang_output_section_statement_type *os; lang_output_section_statement_type *os;
lang_output_section_statement_type **os_tail; lang_output_section_statement_type **os_tail;
asection **bfd_tail;
/* Start building a list of statements for this section. /* Start building a list of statements for this section.
First save the current statement pointer. */ First save the current statement pointer. */
@ -871,6 +872,7 @@ lang_insert_orphan (lang_input_statement_type *file,
os_tail = ((lang_output_section_statement_type **) os_tail = ((lang_output_section_statement_type **)
lang_output_section_statement.tail); lang_output_section_statement.tail);
bfd_tail = output_bfd->section_tail;
os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL, os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL,
load_base, 0); load_base, 0);
@ -902,7 +904,7 @@ lang_insert_orphan (lang_input_statement_type *file,
if (after != NULL && os->bfd_section != NULL) if (after != NULL && os->bfd_section != NULL)
{ {
asection *snew, **pps; asection *snew;
snew = os->bfd_section; snew = os->bfd_section;
@ -929,9 +931,8 @@ lang_insert_orphan (lang_input_statement_type *file,
place->section = &output_bfd->sections; place->section = &output_bfd->sections;
/* Unlink the section. */ /* Unlink the section. */
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next) ASSERT (*bfd_tail == snew);
continue; bfd_section_list_remove (output_bfd, bfd_tail);
bfd_section_list_remove (output_bfd, pps);
/* Now tack it back on in the right place. */ /* Now tack it back on in the right place. */
bfd_section_list_insert (output_bfd, place->section, snew); bfd_section_list_insert (output_bfd, place->section, snew);