From 500806dc2a341c0f2e36baf5a379a0b578b2ee2f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 24 Nov 2025 19:14:16 +1030 Subject: [PATCH] PR 33474 SEGV in init_reloc_cookie This segfault is triggered by a tekhex input. PR 33474 * elflink.c (bfd_elf_gc_sections): Don't try to parse .eh_frame in non-ELF input files. --- bfd/elflink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bfd/elflink.c b/bfd/elflink.c index 60a0a0efd88..ec34c8abcf7 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14649,6 +14649,8 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) asection *sec; struct elf_reloc_cookie cookie; + if (bfd_get_flavour (sub) != bfd_target_elf_flavour) + continue; sec = sub->sections; if (sec == NULL || sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS) continue; -- 2.47.3