public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] RISC-V: Add support for numbered ISA mapping strings
@ 2023-10-13  1:56 Nelson Chu
  0 siblings, 0 replies; only message in thread
From: Nelson Chu @ 2023-10-13  1:56 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9326300e4d3dbe943380b30766ed474d98df07ba

commit 9326300e4d3dbe943380b30766ed474d98df07ba
Author: Joseph Faulls <Joseph.Faulls@imgtec.com>
Date:   Wed Sep 27 12:42:55 2023 +0000

    RISC-V: Add support for numbered ISA mapping strings
    
    The elf psabi allows for mapping symbols to be of the form $x<ISA>.<any>
    
    opcodes/
            * riscv-dis.c (riscv_get_map_state): allow mapping symbol to
            be suffixed by a unique identifier .<any>

Diff:
---
 opcodes/riscv-dis.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index c0fd0625a2d..216916e9426 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -869,7 +869,21 @@ riscv_get_map_state (int n,
     {
       *state = MAP_INSN;
       riscv_release_subset_list (&riscv_subsets);
-      riscv_parse_subset (&riscv_rps_dis, name + 2);
+
+      /* ISA mapping string may be numbered, suffixed with '.n'. Do not
+	 consider this as part of the ISA string.  */
+      char *suffix = strchr (name, '.');
+      if (suffix)
+	{
+	  int suffix_index = (int)(suffix - name);
+	  char *name_substr = xmalloc (suffix_index + 1);
+	  strncpy (name_substr, name, suffix_index);
+	  name_substr[suffix_index] = '\0';
+	  riscv_parse_subset (&riscv_rps_dis, name_substr + 2);
+	  free (name_substr);
+	}
+      else
+	riscv_parse_subset (&riscv_rps_dis, name + 2);
     }
   else
     return false;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-13  1:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13  1:56 [binutils-gdb] RISC-V: Add support for numbered ISA mapping strings Nelson Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).