ip2k: don't look at stab sections without relocs
authorAlan Modra <amodra@gmail.com>
Wed, 22 Feb 2023 07:41:25 +0000 (18:11 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 23 Feb 2023 02:28:53 +0000 (12:58 +1030)
No need to read contents if we won't do anything.

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

bfd/elf32-ip2k.c

index cb1ab0e12e578556257288d8310604ea1234b708..901043790962b293edb261d2379e4ab2562a405d 100644 (file)
@@ -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;