xtensa: properly check reloc address

Message ID abu-McIB5ZOFWM4r@squeak.grove.modra.org
State New
Headers
Series xtensa: properly check reloc address |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Alan Modra March 19, 2026, 9:13 a.m. UTC
  The existing check didn't take the reloc size into account.

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

Patch

diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 1faa884f1d8..8a1e2e064ea 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -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