binutils Newspaper
NOVEMBER 30, 2026
risc-v — Proposed

RISC-V: Add framework for vendor-specific relocations.

Adds a framework to binutils to support vendor-specific RISC-V relocations, enabling custom relocation types beyond the standard set.

This patch introduces a framework within binutils to handle vendor-specific relocations for the RISC-V architecture, as defined by the RISC-V psABI. It allows vendors to define their own relocation types within a reserved range (192-255), each preceded by an R_RISCV_VENDOR relocation. The changes affect readelf, objdump, and ld, enabling them to recognize and process these custom relocations. GAS will emit the R_RISCV_VENDOR directive before each vendor-specific relocation it generates.

In the Thread 1 participant
  1. Ethan Y. C. Liang proposer

    Proposes adding a framework to binutils for RISC-V vendor-specific relocations.

    “The RISC-V psABI reserves relocation numbers 192-255 for vendor-specific relocations [1]. Each of them must be preceded by an R_RISCV_VENDOR at the same offset, whose symbol identifies the vendor. This patch adds the framework for them; no vendor is added yet.”

In Details

This patch implements the framework in binutils (specifically BFD, readelf, objdump, and ld) to support the RISC-V psABI's mechanism for vendor-specific relocations. These custom relocations occupy the 192-255 range and must be preceded by an R_RISCV_VENDOR relocation whose symbol identifies the vendor. The patch defines how to register new vendors, how the tools should interpret and display these relocations, and how ld and gas should handle them, including error checking for malformed vendor relocations.

For Context
RISC-V
An open-source instruction set architecture based on RISC principles.
psABI
Processor-Specific Application Binary Interface. Defines the low-level conventions for function calls, data types, and other aspects of program execution for a specific processor architecture and operating system.
relocation
Information in an object file that describes how to modify memory addresses and other references when the code or data is loaded into memory or linked with other modules. Relocations are necessary to make code position-independent or to resolve external references.
R_RISCV_VENDOR
A specific type of relocation for RISC-V that signals the presence of a vendor-specific relocation following it.
GAS
GNU Assembler. The assembler used in the GNU toolchain.
BFD
Binary File Descriptor library. A low-level library used by binutils to handle various object file formats.
ld
The GNU linker, which combines object files and libraries into an executable.
Filed Under: binutilsrisc-vrelocationelfABI