From: Alan Modra Date: Sun, 9 Feb 2025 22:00:51 +0000 (+1030) Subject: PR32664, compressed debug section naming confusion X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79e6242a1cd8d63663c7a875cbdb7805e374710f;p=thirdparty%2Fbinutils-gdb.git 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 --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] == '_') {