From: Nick Clifton Date: Fri, 30 May 2025 14:31:14 +0000 (+0100) Subject: Prevent illegal memory access when generating map file entries for ifuncs removed... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61701c57f343776a7af84ee6bddecd3c39cd61bd;p=thirdparty%2Fbinutils-gdb.git Prevent illegal memory access when generating map file entries for ifuncs removed by garbage collection --- diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 8a36eef9c7d..6867d493469 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -5247,6 +5247,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, + got_offset); if (PLT_LOCAL_IFUNC_P (info, h)) { + if (h->root.u.def.section == NULL) + return false; + info->callbacks->minfo (_("Local IFUNC function `%s' in %pB\n"), h->root.root.string, h->root.u.def.section->owner); @@ -5415,6 +5418,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, } if (SYMBOL_REFERENCES_LOCAL_P (info, h)) { + if (h->root.u.def.section == NULL) + return false; + info->callbacks->minfo (_("Local IFUNC function `%s' in %pB\n"), h->root.root.string, h->root.u.def.section->owner);