[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/13233] --gc-sections discards .debug_types

From: amodra at gmail dot com
Subject: [Bug ld/13233] --gc-sections discards .debug_types
Date: Thu, 29 Sep 2011 01:15:58 +0000


Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
             Status|NEW                         |ASSIGNED
                 CC|amodra at gmail dot com     |
         AssignedTo|unassigned at sourceware    |amodra at gmail dot com
                   |dot org                     |

--- Comment #6 from Alan Modra <amodra at gmail dot com> 2011-09-29 01:15:58 
UTC ---
Huh, if .debug_types is now made part of a comdat group (when did that
happen?), then are you not telling the linker that you want this section to be
discarded according to the usual rules for groups?  Of course, the linker
generally only marks groups as needed when seeing a reference via some
relocation from another kept section.  Other references like the .debug_info
one shown here are not seen.  You could call that a bug, but I certainly am not
motivated to write the code to process debug sections for --gc-sections!

I'd say
a) It's a gcc bug to put .debug_types in a single member comdat group since it
totally ignores current linker limitations regarding group processing.
b) HJ's patch is wrong as it disables a more reasonable use of group sections
which would be to put all code, data, *and* debug info for a function into a
group. I know there are problems with actually doing that..

It might be reasonable for the linker to keep single-member comdat groups
containing just debug info.  Jan, does this work for you?

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 

       /* 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;

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]