riscv: Switch relax delete-range tests to assembler source
RISC-V linker tests for relaxation delete-range now use assembler source and dump files instead of hex encoding.
This patch updates the RISC-V linker test suite to use assembler source files (.s) and object dump files (.d) for testing the relaxation delete-range functionality. This change replaces previous tests that encoded objects as hexadecimal values. The new tests, which assemble source code with specific relocation types, have been verified on master and link identically with and without the patch.
- proposer
Submits a patch to change RISC-V relax-underflow tests to use assembler source and dump files.
“The new tests assemble one source with the R_RISCV_ALIGN relocation at offset 8 (relaxes and links; .text shrinks to 0x12) or at offset 22 (the deletion would pass the end of .text, so ld rejects it).”
In Details
This patch modifies the test infrastructure for the RISC-V linker (ld) within binutils, specifically for testing the relaxation of delete-range operations. It replaces existing tests that used hex-encoded object data with a more robust approach using assembler source files and objdump outputs. This aligns with previous review feedback and aims to provide clearer, more maintainable tests for scenarios where linker relaxation might incorrectly delete code past the intended boundaries.
- RISC-V
- An open-standard instruction set architecture (ISA) based on RISC principles, increasingly adopted for various computing applications.
- linker
- A program that combines various pieces of code and data into a single file that can be loaded into memory and executed.
- relaxation
- A linker optimization technique where the linker adjusts branch offsets and other relative addressing information to produce smaller or more efficient code, often by overwriting placeholder instructions.
- R_RISCV_ALIGN
- A RISC-V relocation type used to adjust alignment, relevant in the context of linker relaxation.
- objdump
- A command-line utility that displays information from object files, including disassembled code.