binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld Performance Win

RISC-V linker gains --relax-tbljal option for table-jump relaxation

The RISC-V linker now accepts `--relax-tbljal` to enable table-jump relaxation.

The RISC-V linker has been updated to parse and process the --relax-tbljal and --no-relax-tbljal options. These options control the enablement of table-jump relaxation (Zcmt extension) and are registered within the RISC-V emulation parameters. The feature is disabled by default, and unsupported schemes are rejected. Documentation has been updated to describe the new options, supported link modes, and requirements for jump table base initialization.

In Details

This commit introduces the command-line interface for RISC-V table-jump relaxation in the GNU linker. It modifies ldlex.h, emultempl/riscvelf.em, and ld.texi to register and document the --relax-tbljal[=zcmt] and --no-relax-tbljal options. The RISC-V emulation parameters (struct riscv_elf_params in bfd/elfxx-riscv.h) are extended with a relax_zcmt flag to store the user's preference. The linker now parses these options and stores the resulting state. This parameter is then used by subsequent BFD relaxation passes, as seen in the next patch.

For Context
RISC-V
An open-source instruction set architecture (ISA) based on RISC principles. It is designed to be simple, modular, and extensible.
ld
The GNU linker, responsible for combining object files and libraries into an executable or shared library.
Table-jump relaxation
An optimization technique in linkers where indirect jumps or calls are analyzed. If a set of targets can be grouped and efficiently handled by a jump table, the linker rewrites the code to use the table, potentially reducing code size or improving performance.
Zcmt
A RISC-V extension that supports table-jump relaxation, an optimization technique for indirect branches.
Emulation parameters
Configuration settings specific to a particular architecture or target environment that the linker uses to control its behavior.
Filed Under: risc-vlinkeroptimizationcommand-line option