[binutils-gdb] ip2k: don't look at stab sections without relocs

Alan Modra amodra@sourceware.org
Thu Feb 23 03:51:15 GMT 2023


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

commit 98571cade24f890418faf183a21a3a4f0129f960
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Feb 22 18:11:25 2023 +1030

    ip2k: don't look at stab sections without relocs
    
    No need to read contents if we won't do anything.
    
            * elf32-ip2k.c (adjust_all_relocations): Skip stab sections
            without relocs.

Diff:
---
 bfd/elf32-ip2k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;


More information about the Binutils-cvs mailing list