From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7803) id 878D63858C30; Fri, 13 Oct 2023 01:56:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 878D63858C30 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nelson Chu To: bfd-cvs@sourceware.org Subject: [binutils-gdb] RISC-V: Add support for numbered ISA mapping strings X-Act-Checkin: binutils-gdb X-Git-Author: Joseph Faulls X-Git-Refname: refs/heads/master X-Git-Oldrev: 5772d798236d493a0cdfd75b41520527e3129759 X-Git-Newrev: 9326300e4d3dbe943380b30766ed474d98df07ba Message-Id: <20231013015609.878D63858C30@sourceware.org> Date: Fri, 13 Oct 2023 01:56:09 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2023 01:56:09 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9326300e4d3d= be943380b30766ed474d98df07ba commit 9326300e4d3dbe943380b30766ed474d98df07ba Author: Joseph Faulls Date: Wed Sep 27 12:42:55 2023 +0000 RISC-V: Add support for numbered ISA mapping strings =20 The elf psabi allows for mapping symbols to be of the form $x. =20 opcodes/ * riscv-dis.c (riscv_get_map_state): allow mapping symbol to be suffixed by a unique identifier . 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 =3D 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 =3D strchr (name, '.'); + if (suffix) + { + int suffix_index =3D (int)(suffix - name); + char *name_substr =3D xmalloc (suffix_index + 1); + strncpy (name_substr, name, suffix_index); + name_substr[suffix_index] =3D '\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;