[binutils-gdb] Prevent illegal memory access when generating map file entries for ifuncs removed by garbage collect

Nick Clifton nickc@sourceware.org
Fri May 30 14:31:23 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=61701c57f343776a7af84ee6bddecd3c39cd61bd

commit 61701c57f343776a7af84ee6bddecd3c39cd61bd
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri May 30 15:31:14 2025 +0100

    Prevent illegal memory access when generating map file entries for ifuncs removed by garbage collection

Diff:
---
 bfd/elf64-x86-64.c | 6 ++++++
 1 file changed, 6 insertions(+)

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);


More information about the Binutils-cvs mailing list