public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ip2k: don't look at stab sections without relocs
@ 2023-02-23  3:49 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-02-23  3:49 UTC (permalink / raw)
  To: binutils

No need to read contents if we won't do anything.

	* elf32-ip2k.c (adjust_all_relocations): Skip stab sections
	without relocs.

diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index cb1ab0e12e5..90104379096 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -623,7 +623,7 @@ adjust_all_relocations (bfd *abfd,
 
   /* Now fix the stab relocations.  */
   stab = bfd_get_section_by_name (abfd, ".stab");
-  if (stab)
+  if (stab && stab->reloc_count != 0)
     {
       bfd_byte *stabcontents, *stabend, *stabp;
       bfd_size_type stab_size = stab->rawsize ? stab->rawsize : stab->size;

-- 
Alan Modra
Australia Development Lab, IBM

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

only message in thread, other threads:[~2023-02-23  3:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23  3:49 ip2k: don't look at stab sections without relocs 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).