Some more section list fixes.

Alan Modra amodra@bigpond.net.au
Tue Jan 15 22:20:00 GMT 2002


Some more fallout from my 2001-12-17 change.

bfd/ChangeLog
	* elf32-arm.h (elf32_arm_size_dynamic_sections): When removing
	sections, use bfd_section_list_remove.
	* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
	* elflink.h (elf_link_add_object_symbols): When removing all
	sections, use bfd_section_list_clear.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.69
diff -u -p -r1.69 elf32-arm.h
--- elf32-arm.h	2002/01/03 14:23:01	1.69
+++ elf32-arm.h	2002/01/16 04:57:01
@@ -3170,12 +3170,16 @@ elf32_arm_size_dynamic_sections (output_
 	  asection ** spp;
 
 	  for (spp = &s->output_section->owner->sections;
-	       *spp != s->output_section;
+	       *spp != NULL;
 	       spp = &(*spp)->next)
-	    ;
-	  *spp = s->output_section->next;
-	  --s->output_section->owner->section_count;
-
+	    {
+	      if (*spp == s->output_section)
+		{
+		  bfd_section_list_remove (s->output_section->owner, spp);
+		  --s->output_section->owner->section_count;
+		  break;
+		}
+	    }
 	  continue;
 	}
 
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.17
diff -u -p -r1.17 elf32-i370.c
--- elf32-i370.c	2001/12/18 17:59:58	1.17
+++ elf32-i370.c	2002/01/16 04:57:02
@@ -881,12 +881,16 @@ i370_elf_size_dynamic_sections (output_b
 	  asection **spp;
 
 	  for (spp = &s->output_section->owner->sections;
-	       *spp != s->output_section;
+	       *spp != NULL;
 	       spp = &(*spp)->next)
-	    ;
-	  *spp = s->output_section->next;
-	  --s->output_section->owner->section_count;
-
+	    {
+	      if (*spp == s->output_section)
+		{
+		  bfd_section_list_remove (s->output_section->owner, spp);
+		  --s->output_section->owner->section_count;
+		  break;
+		}
+	    }
 	  continue;
 	}
       /* Allocate memory for the section contents.  */
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.139
diff -u -p -r1.139 elflink.h
--- elflink.h	2002/01/15 12:52:14	1.139
+++ elflink.h	2002/01/16 04:57:15
@@ -1568,8 +1568,7 @@ elf_link_add_object_symbols (abfd, info)
 	 SEC_NEVER_LOAD flag is not the one we want, because that one
 	 still implies that the section takes up space in the output
 	 file.  */
-      abfd->sections = NULL;
-      abfd->section_count = 0;
+      bfd_section_list_clear (abfd);
 
       /* If this is the first dynamic object found in the link, create
 	 the special sections required for dynamic linking.  */



More information about the Binutils mailing list