diff --git a/bfd/cpu-riscv.c b/bfd/cpu-riscv.c index a478797da69..5ec766d3375 100644 --- a/bfd/cpu-riscv.c +++ b/bfd/cpu-riscv.c @@ -147,6 +147,7 @@ riscv_get_priv_spec_class_from_numbers (unsigned int major, bool riscv_elf_is_mapping_symbols (const char *name) { - return (!strncmp (name, "$d", 2) - || !strncmp (name, "$x", 2)); + return (!strcmp (name, "$d") + || !strcmp (name, "$x") + || !strncmp (name, "$xrv", 4)); } diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index cb521dc8174..68674380797 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -957,9 +957,7 @@ riscv_is_valid_mapping_symbol (int n, return false; name = bfd_asymbol_name(info->symtab[n]); - return (strcmp (name, "$x") == 0 - || strcmp (name, "$d") == 0 - || strncmp (name, "$xrv", 4) == 0); + return riscv_elf_is_mapping_symbols (name); } /* Check the sorted symbol table (sorted by the symbol value), find the