RL78 linker improves relaxation range checks and error propagation
RL78 linker relaxation is more robust with better range checks and failure propagation.
The RL78 linker’s relaxation process has been made more robust by introducing stricter checks for deletion ranges and improving error propagation. The elf32_rl78_relax_delete_bytes function now uses _bfd_elf_relax_delete_range_ok to validate deletion ranges, and failures are properly propagated up through rl78_elf_relax_section. This change, along with wrapping macros in do-while(0) blocks, enhances the reliability of the relaxation process and includes a new DejaGnu regression test to cover underflow scenarios.
In Details
This commit enhances the RL78 linker's relaxation mechanism by incorporating _bfd_elf_relax_delete_range_ok into elf32_rl78_relax_delete_bytes for range validation. Additionally, SNIPNR and SNIP macros are wrapped in do-while(0) for safety. The return status of byte deletion is now propagated correctly in rl78_elf_relax_section, branching to error_return on failure. A DejaGnu test (rl78-relax-underflow.exp) is added to specifically target relaxation underflow issues.
- linker
- A program that combines one or more object files and libraries into a single executable or library.
- relaxation
- A linker optimization that adjusts code or data layout at link time to use more efficient, shorter-range instructions or address formats that were not initially known at compile time.
- RL78
- A microcontroller architecture developed by Renesas.
- ELF
- Executable and Linkable Format, a standard file format for object files, executables, and shared libraries on many Unix-like systems.
- DejaGnu
- A testing framework used for developing and testing software, particularly for GNU tools. It provides a way to write portable test suites.