* ldlang.c (lang_insert_orphan): Use old section_tail rather than
authorAlan Modra <amodra@gmail.com>
Fri, 18 Mar 2005 13:56:26 +0000 (13:56 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 18 Mar 2005 13:56:26 +0000 (13:56 +0000)
traversing the bfd section list to find pointer to new section.

ld/ChangeLog
ld/ldlang.c

index e1a12534bf8810aeb049e90b9178b43fc3d69cdc..dce7055aaf1017554c626d402fd1968e4e4a2c89 100644 (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>
 
        * scripttempl/elf.sc: When CREATE_SHLIB, put .sdata2 and .sbss2
index dc805a3555cad9fd8da2072d5edf2bb92af7cdb2..3c4e9ac86fd542486600a1eb9d833dfdfa192639 100644 (file)
@@ -818,6 +818,7 @@ lang_insert_orphan (lang_input_statement_type *file,
   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_type *file,
 
   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_type *file,
 
   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_type *file,
        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);
This page took 0.030853 seconds and 4 git commands to generate.