From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 69B83385CCBF for ; Thu, 28 Sep 2023 01:41:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 69B83385CCBF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1dc863efb61so6437348fac.0 for ; Wed, 27 Sep 2023 18:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1695865279; x=1696470079; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=n91JyTliJkxIZu5wUI00JSUr6M97ko/M7Ge83xFrAZs=; b=wTodiIasBjwB4HU9KsjwNlfO+fYxTPDKwgommD80rX2AlsAjMLr6V5qnFbcqoc8n+V COgSCiHp1ZxA3YEjqGqYXyAR1wRU199kx3o6IxeMHVqfDCkSrNDLf7Fp2fJYyyv363Dk 2fyssYbzcPJ9UYZG5vENFm5SCsiqYKh2uD7wjJ4jvUMinwL79CjHiFrn/ch7ZAz8rD/F OUc7PjbOqUGBee1nzYhk9ZlJpvmN0njIGtWKBFXVi3ZnFaAu3H1v9U5Wa7K9qNYT62mp qZvGnCi6kMWC4qyynEinrN7NfVmSjfAqccsVlAikwsPfXAAt7VvLEjCntlIotv/lN6Qk LutQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695865279; x=1696470079; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n91JyTliJkxIZu5wUI00JSUr6M97ko/M7Ge83xFrAZs=; b=TrK0E1RQ9lHC/XhpKG6c23HYDG856cq/vioamftaA7Bqqh4+BpR/zXrNdY4KxBIRJa vdhdl/SwRzkNrbyL0FYuxXWtNVmScY1w11fShUTLjjub0APM4XUbAggU9lN9FJrdaNCQ UD7htYpUgHn0g4A78qbWkfqj4S24WafQJptlQab26RhxYUalk8Ch4U11Rog9NFyIqUzo Nc13ZB6lF9NcE1+EA0u8ZAKRKTeJvIy9PRzakY4F9dy8ENfAER/qDbvrMgTycLDRH4pH 6qV/qB7/ER4XxjGExLENAI1SdiZPK71g5xoAg4R6N188UyePO0dx/KYAlkVx73p8nsG5 Qt1w== X-Gm-Message-State: AOJu0YzXvfTnYwcyCvvTM6m51ipmCgDos19qfDwY+0qUQXkQU5rYa2OI kXTRR7Y6kiOQLAy107H8tryq1lv7t6/aoaV4serc3EIzhrtnES0wKMk= X-Google-Smtp-Source: AGHT+IHY5piBroyA/0r6h9kZ8rr6G5FH5D9939Cwnodd7qcQOJDBSCMI34JbqbyR8OaLjMrEP5d+QhRJ9qAYvCV5x+4= X-Received: by 2002:a05:6871:58f:b0:1d5:8da3:f057 with SMTP id u15-20020a056871058f00b001d58da3f057mr3939959oan.59.1695865279627; Wed, 27 Sep 2023 18:41:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nelson Chu Date: Thu, 28 Sep 2023 09:41:08 +0800 Message-ID: Subject: Re: [PATCH v2] RISC-V: Add support for numbered ISA mapping strings To: Joseph Faulls Cc: "binutils@sourceware.org" , "jbeulich@suse.com" Content-Type: multipart/alternative; boundary="0000000000009459780606616755" X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,HTML_MESSAGE,MIME_BOUND_DIGITS_15,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 List-Id: --0000000000009459780606616755 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Okay, although the current GNU assembler won't generate numbered architecture strings, other tools may generate, so this looks reasonable. Thanks Nelson On Wed, Sep 27, 2023 at 8:42=E2=80=AFPM Joseph Faulls wrote: > The elf psabi allows for mapping symbols to be of the form $x. > > > > opcodes/ > > * riscv-dis.c (riscv_get_map_state): allow mapping symbol to > > be suffixed by a unique identifier . > > > > Changes from v1: > > - Use xmalloc (thanks Jan) > > --- > > 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..18a5c26f9a6 100644 > > --- a/opcodes/riscv-dis.c > > +++ b/opcodes/riscv-dis.c > > @@ -869,7 +869,23 @@ 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; > > -- > > 2.34.1 > --0000000000009459780606616755--