RISC-V: Add new relocation types for global array accesses with non-constant indices
Adds RISC-V relocation types R_RISCV_BASE_IDX_* for efficient non-constant global array access, includes relaxation for absolute int12, and renames internal ty…
This third version of the patch introduces new RISC-V relocation types (R_RISCV_BASE_IDX_) to streamline global array accesses with dynamic indices. It clarifies that ‘absolute int12 relaxation’ is now supported for these types and renames internal relocation identifiers like INTERNAL_R_RISCV_BASE_IDX_ to R_RISCV_BASE_IDX_GPREL*. The changes span BFD and GAS, including new test cases.
In Details
This patch set introduces and refines new relocation types for the RISC-V architecture within binutils. The core purpose is to optimize accesses to global arrays when the index is not a constant, by introducing specific relocation types (R_RISCV_BASE_IDX_*). This version v3 updates the support by including a relaxation mechanism for absolute int12 values and renames internal relocation types for clarity. Modifications are made across BFD and GAS, accompanied by new test cases.
- RISC-V
- An open standard Instruction Set Architecture (ISA) based on RISC principles.
- relocation types
- Information in an object file that guides the linker in resolving addresses and creating position-independent code.
- R_RISCV_BASE_IDX_*
- New relocation types for RISC-V designed to optimize global array access with non-constant indices.
- relaxation
- A process in assembly and linking where an instruction that initially used a relative or absolute address can be later adjusted to use a more efficient form, such as a PC-relative address, if the final location is known.
- BFD
- The Binary File Descriptor library, part of GNU binutils, that provides a common API for object file manipulation.
- GAS
- The GNU Assembler, which translates assembly language code into machine code.