binutils Newspaper
NOVEMBER 30, 2026
risc-v — Proposed — Sentiment 8 / 10

RISC-V: Recognize $x.<any> and $d.<any> mapping symbols

Binutils now correctly recognizes RISC-V mapping symbols like $x.<n> and $d.<n>, improving objdump's disassembly.

This patch enhances binutils’ handling of RISC-V mapping symbols by recognizing suffixes like ‘.’ appended to $x and $d. Previously, objdump only handled bare ‘$x’ and ‘$d’, leading to incorrect disassembly where these symbols were treated as labels. This change ensures that clang-generated symbols like ‘$x.’ are correctly interpreted.

In the Thread 4 participants
  1. Kito Cheng <kito.cheng@sifive.com> proposer

    Submits a patch to binutils to correctly recognize RISC-V mapping symbols with suffixes, such as $x.<n> and $d.<n>, which are emitted by clang.

    “The psABI allows a ".<any>" suffix on the $x and $d mapping symbols, and clang emits $x.<n>. objdump only handled the bare names, so it kept the previous ISA or state and printed the symbols as labels.”
  2. Jerry Zhang Jian <jerry.zhangjian@sifive.com> contributor

    The original author of the work, whose patch is being submitted by Kito Cheng.

  3. Jeff Law <jeffreyalaw@gmail.com> reviewer

    Reviews the patch, suggesting the use of `startswith()` for the checks and noting that this change will be committed.

    “Use startswith() for these checks, and for the existing $xrv one too.”
  4. Jan Beulich <jbeulich@suse.com> reviewer

    Asks a clarifying question about the change, specifically regarding the use of `startswith()`.

    “On 20.11.2026 15:26, Kito Cheng wrote: > From: Jerry Zhang Jian <jerry.zhangjian@sifive.com> > > The psABI allows a ".<any>" suffix on the $x and $d mapping symbols, and clang emits $x.<n>. objdump only handled the bare names, so it kept the previous ISA or state and printed the symbols as labels.”

Technical Tradeoffs

  • Improves disassembly accuracy for RISC-V code using specific compiler extensions.
  • Ensures better compliance with RISC-V psABI conventions.

In Details

This patch modifies bfd/cpu-riscv.c to correctly identify RISC-V mapping symbols that include suffixes, such as $x.rv32 or $d.lstm. The psABI allows these suffixes, and compilers like clang emit them. The previous implementation in objdump (via BFD) only recognized the base symbols $x and $d, misinterpreting suffixed symbols as standard labels. The fix uses strncmp (updated to startswith in a later revision) to handle these suffixed symbols, improving disassembly accuracy.

For Context
RISC-V
An open-standard instruction set architecture based on RISC principles.
psABI
The Application Binary Interface specific to the Platform, often referring to conventions for function calls, data types, and symbol naming.
objdump
A utility that displays information from object files, including disassembly.
mapping symbols
Special symbols used in RISC-V to indicate processor ISA extensions or modes.
BFD
Binutils Format Description, a library used by binutils to support various object file formats.
Filed Under: RISC-Vbinutilsobjdumpdisassemblysymbols