Fix ld/13233 --gc-sections discards .debug_types

Alan Modra amodra@gmail.com
Thu Sep 29 05:43:00 GMT 2011


Applied mainline and branch.

	PR ld/13233
	* elflink.c (_bfd_elf_gc_mark_extra_sections): Mark single member
	debug and special section groups.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.420
diff -u -p -r1.420 elflink.c
--- bfd/elflink.c	16 Sep 2011 01:17:16 -0000	1.420
+++ bfd/elflink.c	29 Sep 2011 01:10:38 -0000
@@ -11667,9 +11667,10 @@ _bfd_elf_gc_mark_extra_sections (struct 
 	continue;
 
       /* Keep debug and special sections like .comment when they are
-	 not part of a group.  */
+	 not part of a group, or when we have single-member groups.  */
       for (isec = ibfd->sections; isec != NULL; isec = isec->next)
-	if (elf_next_in_group (isec) == NULL
+	if ((elf_next_in_group (isec) == NULL
+	     || elf_next_in_group (isec) == isec)
 	    && ((isec->flags & SEC_DEBUGGING) != 0
 		|| (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0))
 	  isec->gc_mark = 1;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list