From 2b33b0d960076b1186bcc454a9627a5451dca17a Mon Sep 17 00:00:00 2001 From: Patrick O'Neill Date: Thu, 30 Nov 2023 18:47:39 -0800 Subject: RISC-V: Make riscv_is_mapping_symbol stricter riscv_is_mapping_symbol currently accepts any symbol that starts with $x or $d. This patch makes the check more strict, requiring exactly $x, $d, or $xrv. It also makes use of this stricter mapping in riscv_is_valid_mapping_symbol. ChangeLog: * bfd/cpu-riscv.c (riscv_elf_is_mapping_symbols): Match only strings that are exactly $x, $d, or $xrv. * opcodes/riscv-dis.c (riscv_is_valid_mapping_symbol): Use riscv_elf_is_mapping_symbols. Signed-off-by: Patrick O'Neill --- bfd/cpu-riscv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bfd') diff --git a/bfd/cpu-riscv.c b/bfd/cpu-riscv.c index a478797..5ec766d 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)); } -- cgit v1.1