rl78: check relaxation delete range, propagate failures
Adds range checking and failure propagation for deletion operations during RL78 code relaxation.
This change enhances the RL78 relaxation process by validating deletion ranges in elf32_rl78_relax_delete_bytes and propagating any failures to rl78_elf_relax_section. It also wraps related macros and adds a new regression test to cover underflow scenarios in relaxation.
In Details
This commit introduces safety checks for deletion operations within the RL78 relaxation mechanism. It utilizes _bfd_elf_relax_delete_range_ok to validate deletion ranges in elf32_rl78_relax_delete_bytes, ensuring that attempts to delete bytes do not go out of bounds. Failures from this check are now propagated to rl78_elf_relax_section, causing relaxation to abort on error. Additionally, SNIPNR and SNIP macros are wrapped in do-while(0) blocks for correct usage in C control structures, and a new DejaGnu test rl78-relax-underflow.exp is added to verify this functionality. The author…
- RL78
- A family of microcontrollers from Renesas Electronics. Binutils supports targeting this architecture, including its specific instruction set and object file formats.
- relaxation
- A process in linkers and assemblers where certain code constructs (e.g., branch instructions with fixed offsets) are modified to use different, more efficient, or more compact forms. This often involves adjusting addresses and offsets.
- ELF
- Executable and Linkable Format. A common standard file format for object files, executables, and shared libraries on Unix-like systems. Binutils tools heavily interact with ELF files.
- BFD
- Binary File Descriptor library. It's a part of GNU Binutils used to abstract away the details of different object file formats (like ELF, COFF, a.out).
- DejaGnu
- A testing framework for software developers. It provides a common interface for writing unit tests and regression tests, often used for tools like GCC and Binutils.