Skip to content

Commit

Permalink
RISC-V: Make mapping symbol checking consistent
Browse files Browse the repository at this point in the history
There were two places where the mapping symbols are checked but had
different conditions.

-    riscv_get_map_state:          "$x" or "$d"
-    riscv_elf_is_mapping_symbols: Starts with either "$x" or "$d"

Considering recent proposals and Nelson's "RISC-V: Output mapping
symbols with ISA string once .option arch is used.", it's better to make
symbol checking consistent (whether the symbol _starts_ with "$[xd]").

opcodes/ChangeLog:

	* riscv-dis.c (riscv_get_map_state): Change the condition for
	consistency.
  • Loading branch information
a4lg committed Sep 4, 2022
1 parent f47de51 commit 15e72cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opcodes/riscv-dis.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,9 @@ riscv_get_map_state (int n,
return false;

name = bfd_asymbol_name(info->symtab[n]);
if (strcmp (name, "$x") == 0)
if (startswith (name, "$x"))
*state = MAP_INSN;
else if (strcmp (name, "$d") == 0)
else if (startswith (name, "$d"))
*state = MAP_DATA;
else
return false;
Expand Down

0 comments on commit 15e72cc

Please sign in to comment.