[v2,03/11] RISC-V: Make mapping symbol checking consistent
Checks
Commit Message
From: Tsukasa OI <research_trasio@irq.a4lg.com>
There were two places where the mapping symbols are checked but had
different conditions.
- riscv_get_map_state: "$d" or starts with "$x"
- riscv_elf_is_mapping_symbols: Starts with either "$x" or "$d"
Considering recent mapping symbol proposal, it's better to make symbol
checking consistent (whether the symbol _starts_ with "$[xd]").
It only checks prefix "$xrv" (mapping symbol with ISA string) only when the
prefix "$x" is matched.
opcodes/ChangeLog:
* riscv-dis.c (riscv_get_map_state): Change the condition for
consistency.
---
opcodes/riscv-dis.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
@@ -834,16 +834,17 @@ riscv_get_map_state (int n,
return false;
name = bfd_asymbol_name(info->symtab[n]);
- if (strcmp (name, "$x") == 0)
- *state = MAP_INSN;
- else if (strcmp (name, "$d") == 0)
- *state = MAP_DATA;
- else if (strncmp (name, "$xrv", 4) == 0)
+ if (startswith (name, "$x"))
{
+ if (startswith (name + 2, "rv"))
+ {
+ riscv_release_subset_list (&riscv_subsets);
+ riscv_parse_subset (&riscv_rps_dis, name + 2);
+ }
*state = MAP_INSN;
- riscv_release_subset_list (&riscv_subsets);
- riscv_parse_subset (&riscv_rps_dis, name + 2);
}
+ else if (startswith (name, "$d"))
+ *state = MAP_DATA;
else
return false;