[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils-bugs
Subject:    [Bug ld/28009] New: mark .gnu.debuglto_.debug_* as SHT_MIPS_DWARF
From:       "syq at debian dot org" <sourceware-bugzilla () sourceware ! org>
Date:       2021-06-24 8:10:26
Message-ID: bug-28009-70 () http ! sourceware ! org/bugzilla/
[Download RAW message or body]

https://sourceware.org/bugzilla/show_bug.cgi?id=28009

            Bug ID: 28009
           Summary: mark .gnu.debuglto_.debug_* as SHT_MIPS_DWARF
           Product: binutils
           Version: 2.37 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: syq at debian dot org
  Target Milestone: ---

See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99488


When LTO is enabled, debug sections have names like 
   .gnu.debuglto_.debug_*
and which type is marked as PROGBITS.

While normal debug info for MIPS is marked as SHT_MIPS_DWARF.
So linker fails to merge the two sections, which make the output has
2 section with the same name:

root@mipsel:/build/innoextract/innoextract-1.8# readelf -Wa
debian/innoextract/usr/bin/innoextract | grep debug_info
  [32] .debug_info       MIPS_DWARF      00000000 09a8c0 1b77ef 00      0   0 
1
  [40] .debug_info       PROGBITS        00000000 4ff4b4 50302b 00      0   0 
1

Let's just mark .gnu.debuglto_.debug_* as SHT_MIPS_DWARF.

Index: binutils-2.36.50.20210618/bfd/elfxx-mips.c
===================================================================
--- binutils-2.36.50.20210618.orig/bfd/elfxx-mips.c
+++ binutils-2.36.50.20210618/bfd/elfxx-mips.c
@@ -7448,7 +7448,9 @@ _bfd_mips_elf_section_from_shdr (bfd *ab
       break;
     case SHT_MIPS_DWARF:
       if (! startswith (name, ".debug_")
-         && ! startswith (name, ".zdebug_"))
+         && ! startswith (name, ".gnu.debuglto_.debug_")
+         && ! startswith (name, ".zdebug_")
+         && ! startswith (name, ".gnu.debuglto_.zdebug_"))
        return false;
       break;
     case SHT_MIPS_SYMBOL_LIB:
@@ -7669,7 +7671,9 @@ _bfd_mips_elf_fake_sections (bfd *abfd,
       hdr->sh_entsize = sizeof (Elf_External_ABIFlags_v0);
     }
   else if (startswith (name, ".debug_")
-          || startswith (name, ".zdebug_"))
+          || startswith (name, ".gnu.debuglto_.debug_")
+          || startswith (name, ".zdebug_")
+          || startswith (name, ".gnu.debuglto_.zdebug_"))
     {
       hdr->sh_type = SHT_MIPS_DWARF;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic