Message ID | LO4P265MB5914E1FBFD4DE046CC1F80E880C2A@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2553353vqu; Wed, 27 Sep 2023 04:20:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmYsFx3V2IPhCthIZ72WSzAcoib5WAEb+11s7tddzcbrsUxJMRrOqi5NYjSplxlxeF1Hna X-Received: by 2002:a05:6512:2f2:b0:503:383c:996d with SMTP id m18-20020a05651202f200b00503383c996dmr1378928lfq.12.1695813625062; Wed, 27 Sep 2023 04:20:25 -0700 (PDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n24-20020aa7db58000000b005346872924csi3082908edt.625.2023.09.27.04.20.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 04:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@imgtec.com header.s=dk201812 header.b=Rvtq82oe; dkim=neutral (body hash did not verify) header.i=@IMGTecCRM.onmicrosoft.com header.s=selector2-IMGTecCRM-onmicrosoft-com header.b="QBSw/Cht"; arc=fail (body hash mismatch); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56DF73860758 for <ouuuleilei@gmail.com>; Wed, 27 Sep 2023 11:20:21 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) by sourceware.org (Postfix) with ESMTPS id B358D3858436 for <binutils@sourceware.org>; Wed, 27 Sep 2023 11:20:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B358D3858436 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=imgtec.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=imgtec.com Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 38R726Wo000629; Wed, 27 Sep 2023 12:20:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h= from:to:cc:subject:date:message-id:content-type:mime-version; s= dk201812; bh=UtVVWDcZYEH0PARa+hH+wwwNmAsjPIUJnU78vzwUB6o=; b=Rvt q82oee6aYCPPTWuf+O3ttMENxru2vJ6ytf/559ZJCbUYTHnBJaT7arLKjbhC4Z+1 49BPTgARajK1mt8qzAoCSyVSTBPEz1vN3Q4YqhOwDPiIWbrC3vU8jTmDm0Sa4xPl N7VTHMZ3OO7VgxGjcqqwN2V8hkYqjcihXMJvRZBBH9ANDj6dLdezMhNDLI1nyjwg SjY8UtgJW6RD8oSFMh9BV8ary7pYt6wyFqT5arZKmGcbh0VHN+BLU2L+yD2M81Er wMbFC7gjcC0+6kgce+jkfppxrnfQ9FzfSm7w02XuJZS9gvuM/ERkDG0WqoQNNE1z UXJ+rMNHBKg9+l1lQwQ== Received: from hhmail05.hh.imgtec.org ([217.156.249.195]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 3t9r3sb6pn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 27 Sep 2023 12:20:12 +0100 (BST) Received: from HHMAIL04.hh.imgtec.org (10.100.10.119) by HHMAIL05.hh.imgtec.org (10.100.10.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 27 Sep 2023 12:20:11 +0100 Received: from GBR01-LO2-obe.outbound.protection.outlook.com (104.47.21.50) by email.imgtec.com (10.100.10.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31 via Frontend Transport; Wed, 27 Sep 2023 12:20:11 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eGow5yX0p8V5RaKf3WXBs90bGcT2Qcn72Fb/NQTIOrwUVIUpR9GyXuXWLYLomlnMq6bSLIGHXYvBdt6l8Tvgd39QfDhJWdRAFJ+fX8biEboR2Rxomwr0JX6EFmWZk1PGhSkg2mK2XJaimDDQMYE4HEOOIBsKkOSMus9n113npq/VST1uaKp/Z8ES9ZVgwvvZFCTZBKr+zIB+xDumXt/8j+KAorYAE7gA4u4l5Pvo8LNlFIVInDvyfzgTyRLpx3vrUwEpkyylYZRdkOakPsu166aVrdjejQbqfBljoJ3N3hTIY/JEtp0nWD93NF5JjYcTaxlY2M8sYFgNX2A/UEzm5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UtVVWDcZYEH0PARa+hH+wwwNmAsjPIUJnU78vzwUB6o=; b=YX6ejcThKPucEETl+ndAOlw1Ff915sqsfMc+6sa60M/5Bdm1ZRZiUSB9CyrWQAfA6w9F86KGliBKEyet2t8GYneN2yUP7EiMoMfo0Wt7ZlUw8iLwC9lCjn0h5gwDOcBl6dxlWmkFVQTtWk7UKXGj3s8yvV/1oPBXnhvrgTAMNqpSjAiGHn9BO6pCOC1ydttNSwl9RCNwju0qc9Pej/OYeXMCNzBx7K7NVdN7XseXzeguw9bfoRs1J7QpmOR97bwJHfYtmrv6AI130UQ66+4n/9NR2b7jzCxIy5WtQFa2itRNeLhslB6a5HlbO7uI9NRcKw7JhA+kpLkbm8fqI2siuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=imgtec.com; dmarc=pass action=none header.from=imgtec.com; dkim=pass header.d=imgtec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=IMGTecCRM.onmicrosoft.com; s=selector2-IMGTecCRM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UtVVWDcZYEH0PARa+hH+wwwNmAsjPIUJnU78vzwUB6o=; b=QBSw/Cht41wypqTOO0ZZlHs2t0V7UaZW0YwouOKksRjz7fuj/lzreQJSUBFoME8sMW822gws1kWkB/4LevrgNMPC9f2cP/Fysf0y7982I3Fbp8xEtUv6avIkW3w/HjFxCFFFr/scT61hzt2pWAC3tJZG6enu/ckcpIZhQu3E02Y= Received: from LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:29f::11) by LO0P265MB5543.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:240::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Wed, 27 Sep 2023 11:20:10 +0000 Received: from LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM ([fe80::3fac:2722:f9cf:2f39]) by LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM ([fe80::3fac:2722:f9cf:2f39%4]) with mapi id 15.20.6838.016; Wed, 27 Sep 2023 11:20:10 +0000 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 Thread-Topic: [PATCH] RISC-V: Add support for numbered ISA mapping strings Thread-Index: AdnxNJLAtMJJ9sM0TG2JG1elJ7xn2g== Date: Wed, 27 Sep 2023 11:20:09 +0000 Message-ID: <LO4P265MB5914E1FBFD4DE046CC1F80E880C2A@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LO4P265MB5914:EE_|LO0P265MB5543:EE_ x-ms-office365-filtering-correlation-id: b5ac9ddb-e2fe-48bc-5514-08dbbf4bb61d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZArQfTz8UKXW6NpiSs4pslaecm8+VlBie5F7oZ0UoJSBK5oB3pc8vkPtPLW76bWluNlLMcxweKvZ3UZot21UIpXv6tKG+MucgleYplMKLQhWdg0mzdeXsmeP3mXa0vlwlC8k2wlYv4TeSFQSIxksrxjoOIb5yhmY1vDLp3WJzPpFoaPm0dQAhweoHq7SDB1S5R6nfL1BjzW/O4aR/+sA0PXYThKcTImLfJ+BlVYEZc7QD/hleYkB3exorpxv5k9zTPdw0YlCz8luHUSP+cBePlCpukLlTsWRCCP9wwkWoIBPM38I6PZu1z+FWrMZUpJcfbMFMVC+1uPofvQQ2HphYfIi4QUmaLGKM3ewEMPkVEmg8wC1kmXhf2qHbbGFbdwX6MWx3IdyNAtvLVkwaOndbaKlj7/HSsRZcoh4Ea8wjjUDchEbyuwf2gz0dGd4Smv7mOltC9+Hqdj8+mZ5EkCh73SI5NHrk/tgHNh62hEY017Rf0RDrxVWbjSC/X7vhV7D6AacMngVyz7oWWR1+S+YH1vSokanrWmnKomtFbQf7PRsdqD/yWBNUliGSDKe0oR2qcKY9J1KZZee+o382+xaSkW/sJfxpO/zmYMrQiWoR6oCfyZ8njzhkxBbkLHZxcJK x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(346002)(39850400004)(136003)(396003)(366004)(376002)(230922051799003)(451199024)(186009)(1800799009)(2906002)(4326008)(8936002)(52536014)(41300700001)(5660300002)(8676002)(478600001)(71200400001)(7696005)(6506007)(9686003)(26005)(83380400001)(316002)(66556008)(66946007)(66446008)(64756008)(66476007)(6916009)(76116006)(122000001)(38100700002)(86362001)(55016003)(33656002)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: +OCkMMr7KwK9PUeBagQrjGTMhcR+C2tJ5eAyt8SjI7rcWQd33Lh3F5iRkEQAPaBA8B76XGLn7y6SlKFXu/Xmtu581gFSuSJjBxR34lZeBSYlqXwLdcaktCugsArt7TUrB6SRl3bFghR3lWO5aqrUvhunuw9yQSTaiWah4jjdDKvUUqvKNPKOuQ+DNwiHL3x5Zo6NlDritSdAdnCQc1qk715w523RN+f9/ak4If46QBiQ6UfuImq0O7risSd2/QgeJTyo5XhFRgBdb7u0mP1okE7Je2kiceTXOxfW43v7ZNE37knlJyiJCmXsQmKkwwrmIE9pFVQOZz0Ijfm3SSimfzJjU9eQW5XLkmmJLI6nZ2+O59VyopbWQu7F/Y96/CO0sPlCz8CHDzztJymDxDGUMGk+hfAh4PnM9QI57ePO3jL575NM274b936JTMyx+Zg2yHFc/GxdpAedvvLJVNXyovv76rWzJfl9FDOMWjDTQpt4oQG9dUsDl+EcRDDsUQ64MmD6snWvToTVi2wDwoWLXXYM/RPJErxM2LiCv3gzMEe6/S8J/ehiT1Ev0Vw5PgKDLseoZgnJ4+UZ6OEKB+UVW1p5aoj3wPUywh6D77jZaJ8aknHq7cMzPLF+tX4PMB2ZeExjuyQTm/zokwWXz/K/Um+18sV1LpknvPns6qZNlC2QqY3lcG31eq5+yfPS9KmQNsn4sGFM46Jsw8xHgRB4HF6xGMFTMc7MqxM//El9YU5+X3RL1ZOAJ/dv/3EIAoffuYSP5wTRDD92KDzhDMgcMswRpSioevYDr/g+4sHOm356+OczETLsltidZ4FPaA3vWSL8NE9x5PrMTmgx23gw3sQotn3itwGPXHoY6YwOdVPTprSNj6a6ID/i1BoqAfuFUKhty0QHnOxQNRf0WgW3VB2K80m7LA6gOPvlbjzjF2A8gXTV6RAyMjEPAMoVBO5lwItsPxN/XfEcLwMghM9UzGMiaAtmRDYjIYYbgX2H16XZ/PtbcbLiXtKAckExKBrjkjUPV7AHfCc9JxSIzqc5KCxsrdKicxC6swsj4F5TbdKJYxUQ2nI2CNvRLldvrpx80JZ6S0hwaINh7Bt35h+lI5szoRFDvUiNj3NB1VExKRYFCnp9e7nw5/3MrvFH8Z6xSdWZUUP8SiPfJpSfkIt+mMQnsGwLxDbHtJoAjQjq/JXD1aHbbfLUT5CciqWReTrubggQBOMfegZTLbHl7ANCPb4k1Pl3CqfAfnQ1Tx7kcg1gTkN4xLWX5gy13r1w/YDayMG27GBLZceEh2nV6BTYGsVwX+mSS1pACEcuwEyX5n34pCz5pIwPdKrpNGjb6FNfj8gUMrdohmVR72XV/ID3JODQAD1pKMIV/Z4bwC8AMhsLViPLU+roVBEJWWWDWHOi/vQlXq/ZUNk3d/Fc8FhJSXWG6yY/kslAnxt2aDE+z3nRk8SxFt58j40vydvkP+pVuiaJafJKNP84IDSn/3/sIuAsbxF3QQ75GwhiPXPhq9WFvFqcZMnxXT3lU6rgwkjwuN5a28FQEIlEPzcEEkJPhLErdanaRI+mwxPVa+YtOiRBGAMym+0C20W7Ks8pTfou MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: b5ac9ddb-e2fe-48bc-5514-08dbbf4bb61d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2023 11:20:10.1876 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0d5fd8bb-e8c2-4e0a-8dd5-2c264f7140fe X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bhoy0JQb442QGhtW1qlnGtAIwfiEe+NZ41EXyi+mX8xpX9tUERkpWPnra1KsKBEjL6XwgFO+dn/ZezCVHllMYzQulnepnpfZ0m3ZGxka9Q4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB5543 X-OriginatorOrg: imgtec.com X-EXCLAIMER-MD-CONFIG: 15a78312-3e47-46eb-9010-2e54d84a9631 X-Proofpoint-ORIG-GUID: J61HYeOAGeGZOdzSx7do9IIkTguZ9qa3 X-Proofpoint-GUID: J61HYeOAGeGZOdzSx7do9IIkTguZ9qa3 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.30 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778189467613695123 X-GMAIL-MSGID: 1778189467613695123 |
Series |
RISC-V: Add support for numbered ISA mapping strings
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Joseph Faulls
Sept. 27, 2023, 11:20 a.m. UTC
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(-) -- 2.34.1
Comments
On 27.09.2023 13:20, Joseph Faulls wrote: > --- 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); You want to either use xmalloc(), or you need to check for getting back NULL here. Jan > + 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
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;