* config/obj-ecoff.c (ecoff_frob_file_before_fix): Correct section
authorAlan Modra <amodra@gmail.com>
Tue, 3 May 2005 17:08:43 +0000 (17:08 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 3 May 2005 17:08:43 +0000 (17:08 +0000)
list traversal.  Use bfd_section_list_prepend.
* config/tc-mmix.c (mmix_frob_file): Don't needlessly iterate
over the section list.
* config/tc-xtensa.c (xtensa_remove_section): Delete.
(xtensa_insert_section): Delete.
(xtensa_move_seg_list_to_beginning): Use bfd_section_list_remove
and bfd_section_list_prepend.
(xtensa_reorder_seg_list): Use bfd_section_list_remove and
bfd_section_list_insert_after.

gas/ChangeLog
gas/config/obj-ecoff.c
gas/config/tc-mmix.c
gas/config/tc-xtensa.c

index 34d5c111add7a9260a56f8df94f27cda8724626c..3210d11066df83a5b4c3909198b7e2c94e048e6f 100644 (file)
@@ -1,3 +1,16 @@
+2005-05-04  Alan Modra  <amodra@bigpond.net.au>
+
+       * config/obj-ecoff.c (ecoff_frob_file_before_fix): Correct section
+       list traversal.  Use bfd_section_list_prepend.
+       * config/tc-mmix.c (mmix_frob_file): Don't needlessly iterate
+       over the section list.
+       * config/tc-xtensa.c (xtensa_remove_section): Delete.
+       (xtensa_insert_section): Delete.
+       (xtensa_move_seg_list_to_beginning): Use bfd_section_list_remove
+       and bfd_section_list_prepend.
+       (xtensa_reorder_seg_list): Use bfd_section_list_remove and
+       bfd_section_list_insert_after.
+
 2005-05-03  Nick Clifton  <nickc@redhat.com>
 
        * config/obj-ecoff.c (ecoff_frob_file_before_fix): Fix invocations
index 6bfb79ea42f2d6e508fc0708dd5e3f93affd15b2..7a1e29f86564b7c4685b6d6dacbd017620ba598e 100644 (file)
@@ -37,7 +37,7 @@ void
 ecoff_frob_file_before_fix (void)
 {
   bfd_vma addr;
-  asection **sec;
+  asection *sec;
 
   /* Set the section VMA values.  We force the .sdata and .sbss
      sections to the end to ensure that their VMA addresses are close
@@ -80,20 +80,19 @@ ecoff_frob_file_before_fix (void)
   for (i = 0; i < n_names; i++)
     secs[i] = NULL;
 
-  for (sec = &stdoutput->sections; *sec !=  NULL;)
+  for (sec = stdoutput->sections; sec != NULL; sec = sec->next)
     {
       for (i = 0; i < n_names; i++)
-       if (!strcmp ((*sec)->name, names[i]))
+       if (!strcmp (sec->name, names[i]))
          {
-           secs[i] = *sec;
-           bfd_section_list_remove (stdoutput, *sec);
+           secs[i] = sec;
+           bfd_section_list_remove (stdoutput, sec);
            break;
          }
       if (i == n_names)
        {
-         bfd_set_section_vma (stdoutput, *sec, addr);
-         addr += bfd_section_size (stdoutput, *sec);
-         sec = &(*sec)->next;
+         bfd_set_section_vma (stdoutput, sec, addr);
+         addr += bfd_section_size (stdoutput, sec);
        }
     }
   for (i = 0; i < n_names; i++)
@@ -104,7 +103,7 @@ ecoff_frob_file_before_fix (void)
       }
   for (i = n_names - 1; i >= 0; i--)
     if (secs[i])
-      bfd_section_list_insert_after (stdoutput, stdoutput->sections, secs[i]);
+      bfd_section_list_prepend (stdoutput, secs[i]);
 
   /* Fill in the register masks.  */
   {
index 356a68ab90b3218c3e7cc51dbe8894966986382a..5fc6ab9b1904ea54e1d30a87ef73a27228b75478 100644 (file)
@@ -3747,18 +3747,11 @@ mmix_frob_file (void)
 
   if (real_reg_section != NULL)
     {
-      asection *secp;
-
       /* FIXME: Pass error state gracefully.  */
       if (bfd_get_section_flags (stdoutput, real_reg_section) & SEC_HAS_CONTENTS)
        as_fatal (_("register section has contents\n"));
 
-      /* Really remove the section.  */
-      for (secp = stdoutput->sections;
-          secp != real_reg_section;
-          secp = secp->next)
-       ;
-      bfd_section_list_remove (stdoutput, secp);
+      bfd_section_list_remove (stdoutput, real_reg_section);
       --stdoutput->section_count;
     }
 
index 9340e4d50e8c528d18f4b18a554173105033cfd0..53d3bad139ff2d780c02528b7e49040ca236c600 100644 (file)
@@ -9682,39 +9682,6 @@ set_subseg_freq (segT seg, subsegT subseg, float total_f, float target_f)
 \f
 /* Segment Lists and emit_state Stuff.  */
 
-/* Remove the segment from the global sections list.  */
-
-static void
-xtensa_remove_section (segT sec)
-{
-  /* Handle brain-dead bfd_section_list_remove macro, which
-     expect the address of the prior section's "next" field, not
-     just the address of the section to remove.  */
-  segT ps_next_ptr = stdoutput->sections;
-
-  while (ps_next_ptr != sec && ps_next_ptr != NULL) 
-    ps_next_ptr = ps_next_ptr->next;
-  
-  assert (ps_next_ptr != NULL);
-
-  bfd_section_list_remove (stdoutput, ps_next_ptr);
-}
-
-
-static void
-xtensa_insert_section (segT after_sec, segT sec)
-{
-  segT after_sec_next;
-
-  if (after_sec == NULL)
-    after_sec_next = stdoutput->sections;
-  else
-    after_sec_next = after_sec->next;
-
-  bfd_section_list_insert_after (stdoutput, after_sec_next, sec);
-}
-
-
 static void
 xtensa_move_seg_list_to_beginning (seg_list *head)
 {
@@ -9725,9 +9692,11 @@ xtensa_move_seg_list_to_beginning (seg_list *head)
 
       /* Move the literal section to the front of the section list.  */
       assert (literal_section);
-      xtensa_remove_section (literal_section);
-      xtensa_insert_section (NULL, literal_section);
-
+      if (literal_section != stdoutput->sections)
+       {
+         bfd_section_list_remove (stdoutput, literal_section);
+         bfd_section_list_prepend (stdoutput, literal_section);
+       }
       head = head->next;
     }
 }
@@ -9893,8 +9862,8 @@ xtensa_reorder_seg_list (seg_list *head, segT after)
       assert (literal_section);
       if (literal_section != after)
        {
-         xtensa_remove_section (literal_section);
-         xtensa_insert_section (after, literal_section);
+         bfd_section_list_remove (stdoutput, literal_section);
+         bfd_section_list_insert_after (stdoutput, after, literal_section);
        }
 
       head = head->next;
This page took 0.039815 seconds and 4 git commands to generate.