[PATCH v3 3/8] avr: check relaxation delete range and propagate failure
Harshit Kumar
harshit7kr@gmail.com
Sat Nov 7 07:50:58 GMT 2026
Validate deletion range in elf32_avr_relax_delete_bytes using
_bfd_elf_relax_delete_range_ok. Propagate failure returns in
elf32_avr_relax_section and branch to error_return on error.
Signed-off-by: Harshit Kumar <harshit7kr@gmail.com>
---
v3:
- Unchanged from v2.
bfd/elf32-avr.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 1e11e3f0..ef10daf4 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -2018,6 +2018,9 @@ elf32_avr_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count,
Elf_Internal_Rela *irel = elf_section_data (sec)->relocs;
Elf_Internal_Rela *irelend = irel + sec->reloc_count;
+ if (! _bfd_elf_relax_delete_range_ok (abfd, sec, addr, count, toaddr))
+ return false;
+
/* Actually delete the bytes. */
if (toaddr - addr - count > 0)
{
@@ -3549,8 +3552,10 @@ elf32_avr_relax_section (bfd *abfd, asection *sec,
First move the alignment directive, then delete
the bytes. */
record->offset -= count;
- elf32_avr_relax_delete_bytes (abfd, sec, addr - count,
- count, false);
+ if (! elf32_avr_relax_delete_bytes (abfd, sec,
+ addr - count,
+ count, false))
+ goto error_return;
*again = true;
}
}
--
2.55.0
More information about the Binutils
mailing list