[PATCH] RISC-V: Recognize $x.<any> and $d.<any> mapping symbols
Jan Beulich
jbeulich@suse.com
Fri Nov 20 14:31:52 GMT 2026
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.
> ---
> bfd/cpu-riscv.c | 2 ++
> gas/testsuite/gas/riscv/mapping-suffix.d | 14 ++++++++++++++
> gas/testsuite/gas/riscv/mapping-suffix.s | 9 +++++++++
> opcodes/riscv-dis.c | 4 ++--
> 4 files changed, 27 insertions(+), 2 deletions(-)
> create mode 100644 gas/testsuite/gas/riscv/mapping-suffix.d
> create mode 100644 gas/testsuite/gas/riscv/mapping-suffix.s
>
> diff --git a/bfd/cpu-riscv.c b/bfd/cpu-riscv.c
> index 26ba1550e14..85b425aa6a5 100644
> --- a/bfd/cpu-riscv.c
> +++ b/bfd/cpu-riscv.c
> @@ -117,6 +117,8 @@ bool
> riscv_elf_is_mapping_symbols (const char *name)
> {
> return (!strcmp (name, "$d")
> + || !strncmp (name, "$d.", 3)
> || !strcmp (name, "$x")
> + || !strncmp (name, "$x.", 3)
> || !strncmp (name, "$xrv", 4));
> }
If I'm not mistaken these days we prefer startswith().
Jan
More information about the Binutils
mailing list