binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v

RISC-V: Add Zcmt table-jump relocation definitions

Binutils now includes linker definitions for RISC-V Zcmt table-jump relocations.

This commit introduces the necessary linker-internal definitions for RISC-V Zcmt table-jump (JVT) relocations. It adds a new relocation type R_RISCV_TABLE_JUMP, a base symbol RISCV_TABLE_JUMP_BASE_SYMBOL, and a section name TABLE_JUMP_SEC_NAME to include/elf/riscv.h. Additionally, it defines Zcmt constants related to table jumps and alterations in include/opcode/riscv.h. This lays the groundwork for linker optimizations involving table jumps.

In Details

This commit adds linker-internal definitions for RISC-V Zcmt table-jump (JVT) relocations. It defines R_RISCV_TABLE_JUMP in include/elf/riscv.h, along with RISCV_TABLE_JUMP_BASE_SYMBOL and TABLE_JUMP_SEC_NAME. The struct riscv_elf_params in elfxx-riscv.c gains a relax_zcmt field. New Zcmt constants, including ZCMT_JT_BEGIN, ZCMT_JT_END, ZCMT_JT_NUM_ENTRIES, ZCMT_JALT_BEGIN, ZCMT_JALT_END, and ZCMT_JALT_NUM_ENTRIES, are added to include/opcode/riscv.h. These definitions are crucial for the linker to process and optimize table-jump instructions.

For Context
RISC-V
An open-standard instruction set architecture (ISA) based on Reduced Instruction Set Computer principles.
Zcmt
A RISC-V non-standard extension that provides table-jump instructions, often used for optimized indirect calls or jumps.
relocation
A process performed by the linker to adjust addresses in machine code to their final locations in memory, based on symbols and their defined addresses.
linker
A program that combines various object files and libraries into a single executable file, resolving symbol references and performing address adjustments.
table-jump
An indirect jump or call instruction that uses a table of addresses to determine the target, often providing performance benefits for multiple targets.
ELF
Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like systems.
Filed Under: risc-vlinkerrelocationZcmt