public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Faulls <Joseph.Faulls@imgtec.com>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Cc: "nelson@rivosinc.com" <nelson@rivosinc.com>
Subject: [PATCH] RISC-V: Add support for numbered ISA mapping strings
Date: Wed, 27 Sep 2023 11:20:09 +0000	[thread overview]
Message-ID: <LO4P265MB5914E1FBFD4DE046CC1F80E880C2A@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

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>
---
opcodes/riscv-dis.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index c0fd0625a2d..2a13a3f9f73 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -869,7 +869,23 @@ 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 = malloc (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;
--
2.34.1

             reply	other threads:[~2023-09-27 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27 11:20 Joseph Faulls [this message]
2023-09-27 12:09 ` Jan Beulich

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=LO4P265MB5914E1FBFD4DE046CC1F80E880C2A@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM \
    --to=joseph.faulls@imgtec.com \
    --cc=binutils@sourceware.org \
    --cc=nelson@rivosinc.com \
    /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).