public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR31872, Segfault in objdump (elf_slurp_reloc_table_from_section)
@ 2024-06-11  0:01 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-06-11  0:01 UTC (permalink / raw)
  To: binutils

This one was triggered by trying to dump an AMDGPU object.
elf64-amdgcn.c lacks support for objdump relocation handling.

	PR 31872
	* elfcode.h (elf_slurp_reloc_table_from_section): Don't segfault
	on NULL elf_info_to_howto_rel.

diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 39dfe0ba234..3dcba4c4fd7 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1614,11 +1614,11 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
 
       relent->addend = rela.r_addend;
 
-      if ((entsize == sizeof (Elf_External_Rela)
-	   && ebd->elf_info_to_howto != NULL)
-	  || ebd->elf_info_to_howto_rel == NULL)
+      res = false;
+      if (entsize == sizeof (Elf_External_Rela)
+	  && ebd->elf_info_to_howto != NULL)
 	res = ebd->elf_info_to_howto (abfd, relent, &rela);
-      else
+      else if (ebd->elf_info_to_howto_rel != NULL)
 	res = ebd->elf_info_to_howto_rel (abfd, relent, &rela);
 
       if (! res || relent->howto == NULL)

-- 
Alan Modra

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-11  0:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11  0:01 PR31872, Segfault in objdump (elf_slurp_reloc_table_from_section) Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).