public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: binutils@sourceware.org
Cc: research_trasio@irq.a4lg.com, binutils@sourceware.org
Subject: Re: [PATCH 1/1] RISC-V: Fix canonical extension order (K and J)
Date: Mon, 28 Mar 2022 17:12:55 -0700 (PDT)	[thread overview]
Message-ID: <mhng-7946e868-60b9-4160-9d9d-33fa091ea4a0@palmer-ri-x1c9> (raw)
In-Reply-To: <dac489a17d399816d6938e6c082bbfeecebfc931.1648473106.git.research_trasio@irq.a4lg.com>

On Mon, 28 Mar 2022 06:12:01 PDT (-0700), binutils@sourceware.org wrote:
> This commit fixes canonical extension order to follow the RISC-V ISA
> Manual draft-20210402-1271737 or later.
>
> bfd/ChangeLog:
>
> 	* elfxx-riscv.c (riscv_recognized_prefixed_ext): Fix "K" extension
> 	prefix to be placed before "J".
> ---
>  bfd/elfxx-riscv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index cb2cc146c04..1219a7b44d4 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -1338,7 +1338,7 @@ riscv_recognized_prefixed_ext (const char *ext)
>  }
>
>  /* Canonical order for single letter extensions.  */
> -static const char riscv_ext_canonical_order[] = "eigmafdqlcbjktpvn";
> +static const char riscv_ext_canonical_order[] = "eigmafdqlcbkjtpvn";
>
>  /* Array is used to compare the orders of standard extensions quickly.  */
>  static int riscv_ext_order[26] = {0};

Looks like this was just a bug in binutils: K went from being 
unspecified to specified in 271737 ("Define canonical location of K 
extension in ISA string"), thus it was never allowed at that other bit 
position.

It looks like GCC also has this wrong, which sort of doubles the 
headache: now we've got this odd coupling between the GCC version and 
binutils version.  I'm not sure what the right thing is to do here: 
certainly rejecting the valid ISA string should be fixed, but I think we 
might need to accept the invalid one for compatibility reasons.  That'll 
be a headache to implement, though, so I'm not sure it's worth it.

Maybe someone has a clever solution to this one?

  reply	other threads:[~2022-03-29  0:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 13:12 [PATCH 0/1] " Tsukasa OI
2022-03-28 13:12 ` [PATCH 1/1] " Tsukasa OI
2022-03-29  0:12   ` Palmer Dabbelt [this message]
2022-04-25  3:52     ` Palmer Dabbelt
2022-05-19  3:40       ` Nelson Chu
2022-05-22  9:35         ` Tsukasa OI

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=mhng-7946e868-60b9-4160-9d9d-33fa091ea4a0@palmer-ri-x1c9 \
    --to=palmer@dabbelt.com \
    --cc=binutils@sourceware.org \
    --cc=research_trasio@irq.a4lg.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).