]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR32664, compressed debug section naming confusion
authorAlan Modra <amodra@gmail.com>
Sun, 9 Feb 2025 22:00:51 +0000 (08:30 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 9 Feb 2025 22:17:19 +0000 (08:47 +1030)
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.

bfd/elf.c

index 0e40d6d1d301d08fcbd26e9d31a6390df67bf7ec..129cac583823cbcfb6eb9dc01c3be1b9b25f5531 100644 (file)
--- 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] == '_')
     {