public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelsonc1225@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] RISC-V: Add support for numbered ISA mapping strings
Date: Fri, 13 Oct 2023 01:56:09 +0000 (GMT)	[thread overview]
Message-ID: <20231013015609.878D63858C30@sourceware.org> (raw)

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;

                 reply	other threads:[~2023-10-13  1:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231013015609.878D63858C30@sourceware.org \
    --to=nelsonc1225@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).