RISC-V linker checks relaxation deletion range and propagates failures.
RISC-V linker now validates deletion ranges during relaxation to prevent underflows and propagates errors.
The RISC-V linker now checks if deletion ranges are valid before attempting to move bytes during relaxation. This prevents potential underflows and ensures that failures are properly propagated to callers. A new DejaGnu regression test is added to specifically catch these underflow conditions.
In Details
This commit enhances error checking in the RISC-V relaxation process within binutils. Specifically, it adds a check using _bfd_elf_relax_delete_range_ok before calling riscv_relax_delete_bytes. Failures from this check are now propagated up to _bfd_riscv_relax_tlsdesc and _bfd_riscv_relax_pc. This is relevant for the linker's handling of relocating TLS descriptors and PC-relative instructions where byte deletions might occur.