[binutils-gdb] PR32664, compressed debug section naming confusion

Alan Modra amodra@sourceware.org
Sun Feb 9 22:19:08 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=79e6242a1cd8d63663c7a875cbdb7805e374710f

commit 79e6242a1cd8d63663c7a875cbdb7805e374710f
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Feb 10 08:30:51 2025 +1030

    PR32664, compressed debug section naming confusion
    
    The pr326664 fuzzer testcase has two .debug_info sections, one
    SHF_ALLOC, one not.  SEC_DEBUGGING is never set for SHF_ALLOC sections
    that happen to be named .debug_info, nor are they compressed.  However
    in this case we get an output section that is both SEC_ALLOC and
    SEC_DEBUGGING which confuses code setting up the output section names
    (.zdebug_* for compressed debug sections), resulting in a -1u index
    into a string table.
    
            PR 32664
            * elf.c (elf_fake_sections): Do not delay naming of SEC_ALLOC
            sections.

Diff:
---
 bfd/elf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bfd/elf.c b/bfd/elf.c
index 0e40d6d1d30..129cac58382 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3542,6 +3542,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
   if (arg->link_info
       && (abfd->flags & BFD_COMPRESS) != 0
       && (asect->flags & SEC_DEBUGGING) != 0
+      && (asect->flags & SEC_ALLOC) == 0
       && name[1] == 'd'
       && name[6] == '_')
     {


More information about the Binutils-cvs mailing list