From 79e6242a1cd8d63663c7a875cbdb7805e374710f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 10 Feb 2025 08:30:51 +1030 Subject: [PATCH] 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. --- 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] == '_') { -- 2.47.3