aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorPatrick O'Neill <patrick@rivosinc.com>2023-11-30 18:47:39 -0800
committerNelson Chu <nelson@rivosinc.com>2023-12-01 11:22:45 +0800
commit2b33b0d960076b1186bcc454a9627a5451dca17a (patch)
tree46e07450d4a852eac0180b4913090f6a3e2aa7bf /bfd
parent8321007a988ecd3acb354e1374682e79f414dd29 (diff)
downloadgdb-2b33b0d960076b1186bcc454a9627a5451dca17a.zip
gdb-2b33b0d960076b1186bcc454a9627a5451dca17a.tar.gz
gdb-2b33b0d960076b1186bcc454a9627a5451dca17a.tar.bz2
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 <patrick@rivosinc.com>
Diffstat (limited to 'bfd')
-rw-r--r--bfd/cpu-riscv.c5
1 files changed, 3 insertions, 2 deletions
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));
}