]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
xtensa: properly check reloc address
authorAlan Modra <amodra@gmail.com>
Thu, 19 Mar 2026 09:10:16 +0000 (19:40 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 19 Mar 2026 09:10:16 +0000 (19:40 +1030)
The existing check didn't take the reloc size into account.

* elf32-xtensa.c (bfd_elf_xtensa_reloc): Use bfd_reloc_offset_in_range.

bfd/elf32-xtensa.c

index 1faa884f1d83e0a67b35fec79b4a77e8282b8242..8a1e2e064ea3e0d9478c96101342eb7fb3d14db9 100644 (file)
@@ -2178,7 +2178,7 @@ bfd_elf_xtensa_reloc (bfd *abfd,
     }
 
   /* Is the address of the relocation really within the section?  */
-  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+  if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
     return bfd_reloc_outofrange;
 
   /* Work out which section the relocation is targeted at and the