From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 09A083858401 for ; Tue, 29 Mar 2022 00:12:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 09A083858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pg1-x530.google.com with SMTP id s72so13411641pgc.5 for ; Mon, 28 Mar 2022 17:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=de/nUXZau7Q3YZkqov89n+lmdh1p0jQ7LDHOO7tgyX8=; b=OlSG1lMqXnUcQ+CE2j2e3YUaKAtKhKlioYN+o+qoxVLaCPEIvUZ289DW56JnqAHqKi I/0y8UcbIi37lQyYwZRLnxs68UV3Kg7ePs8PU3oPRq+LUMr18Ny4096tcPRrjli7LqPn LiVdL3Wmv9LmCw5ODxYsd4dg1A39XGpcT/OPmFKkJkfeFC9ZDPdyX9tqhkqy3mqU79bF F97g9cFgHd+z/kgAoLqq4BVTgjRVGGxqBO/129CoYdPAA5PkQ8ppALtGV4+U0M3r7qsU eEN4zHPoqJ6g+yG0Ku6dvlq+Hgx7xcFW3SbCLKNPcioPjx4EfWWSXCIfYTa9kbdOZuwh saiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=de/nUXZau7Q3YZkqov89n+lmdh1p0jQ7LDHOO7tgyX8=; b=T1bm7nIjxZ6nOVR+iNmD/n4ngxosRUdvoOPZGzfmX1xuaC8+vZyg3BYoApk1hNo/3o vG+yXlT7QjosqH3WikOJO3TWN6RfMSOFPeLT3acIgKrLORPHw8t+tGBXSMKG6giJBrSe XxIfNbuIuNiYejzOezEj9/+Mmye3mIAvmWkeJ8NZfuo1BALeNalyb+P6E2HVVDJYI0MF QG3jUY8MiBUhvGnNc1YDad1neaYJdDRZA1PFw0A8zfciJhytLHFElTr7HU4VdBbX85MG a+prbG3GcRD78lbH9LzGMCHcrAxecuZP6wwHQBfYKzPWVKXZrtbSotGd9e1Pi/cQNXee HhJQ== X-Gm-Message-State: AOAM5327FTObvlO5mwa4e+WnhRM95GM2ufQi7UKGhYFS9gr07cMz4uGh oRGYtzOWA2tzqVRjrF2IH9fyvWuXz44rrw== X-Google-Smtp-Source: ABdhPJyUjZE/XQvifYBsDZqWe7jwrgL543UXpEOB67vSyxM5Ql89xGD0Fw/BVmAb9I/+/Ai3jx13nA== X-Received: by 2002:a05:6a00:15d6:b0:4fa:f217:e2b2 with SMTP id o22-20020a056a0015d600b004faf217e2b2mr22698348pfu.64.1648512775976; Mon, 28 Mar 2022 17:12:55 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id h12-20020a056a00230c00b004faf2563bcasm16232082pfh.114.2022.03.28.17.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 17:12:55 -0700 (PDT) Date: Mon, 28 Mar 2022 17:12:55 -0700 (PDT) X-Google-Original-Date: Mon, 28 Mar 2022 17:12:53 PDT (-0700) Subject: Re: [PATCH 1/1] RISC-V: Fix canonical extension order (K and J) In-Reply-To: CC: research_trasio@irq.a4lg.com, binutils@sourceware.org From: Palmer Dabbelt To: binutils@sourceware.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Mar 2022 00:12:58 -0000 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?