Skip to content

Commit 251b52d

Browse files
committed
RISC-V: Make mapping symbol checking consistent
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.
1 parent 57cf06e commit 251b52d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

opcodes/riscv-dis.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -862,16 +862,17 @@ riscv_get_map_state (int n,
862862
return false;
863863

864864
name = bfd_asymbol_name(info->symtab[n]);
865-
if (strcmp (name, "$x") == 0)
866-
*state = MAP_INSN;
867-
else if (strcmp (name, "$d") == 0)
868-
*state = MAP_DATA;
869-
else if (strncmp (name, "$xrv", 4) == 0)
865+
if (startswith (name, "$x"))
870866
{
867+
if (startswith (name + 2, "rv"))
868+
{
869+
riscv_release_subset_list (&riscv_subsets);
870+
riscv_parse_subset (&riscv_rps_dis, name + 2);
871+
}
871872
*state = MAP_INSN;
872-
riscv_release_subset_list (&riscv_subsets);
873-
riscv_parse_subset (&riscv_rps_dis, name + 2);
874873
}
874+
else if (startswith (name, "$d"))
875+
*state = MAP_DATA;
875876
else
876877
return false;
877878

0 commit comments

Comments
 (0)