[binutils-gdb] RISC-V: Fix the order checking for Z* extension.

Nelson Chu nelsonc1225@sourceware.org
Tue Dec 1 07:34:20 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6729e2c2af2bd94408430734316597843718a484

commit 6729e2c2af2bd94408430734316597843718a484
Author: Nelson Chu <nelson.chu@sifive.com>
Date:   Fri Nov 20 23:42:28 2020 +0800

    RISC-V: Fix the order checking for Z* extension.
    
    We have to check the first char of the Z* extensions, to make sure that
    they follow the order of the standard extensions.  But we can not have
    the testcases for this patch, since we only support the zicsr and zifencei
    so far, both of them are the sub extensions of i.
    
            bfd/
            * elfxx-riscv.c (riscv_parse_prefixed_ext): Use riscv_compare_subsets
            to check the Z* extensions' order.

Diff:
---
 bfd/ChangeLog     | 5 +++++
 bfd/elfxx-riscv.c | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2a5ae822cc5..b3bcf9ea1e6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-01  Nelson Chu  <nelson.chu@sifive.com>
+
+	* elfxx-riscv.c (riscv_parse_prefixed_ext): Use riscv_compare_subsets
+	to check the Z* extensions' order.
+
 2020-12-01  Nelson Chu  <nelson.chu@sifive.com>
 
 	* elfxx-riscv.c (riscv_parse_add_subset): Allow to add g with
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 711b3677180..06967804d6c 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1543,8 +1543,7 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
 	}
 
       /* Check that the extension is in alphabetical order.  */
-      if (!strncasecmp (last_name, config->prefix, 1)
-	  && strcasecmp (last_name, subset) > 0)
+      if (riscv_compare_subsets (last_name, subset) > 0)
 	{
 	  rps->error_handler
 	    (_("-march=%s: %s ISA extension `%s' is not in alphabetical "


More information about the Binutils-cvs mailing list