From afc41ffb993a275d7f5460e8f5a4341729caab4f Mon Sep 17 00:00:00 2001 From: Nelson Chu Date: Wed, 22 Jun 2022 17:57:12 +0800 Subject: [PATCH] RISC-V: Reorder the prefixed extensions which are out of order. This patch has been pending for almost a year... However, I noticed that llvm can already re-order the extensions, even if they are out of orders. Not really sure if they can also re-order the single letter extensions, but at least we can do this for the multi-letter extensions in binutils. bfd/ * elfxx-riscv.c (riscv_parse_prefixed_ext): Removed the code which are used to check the prefixed extension orders. gas/ * testsuite/gas/riscv/march-fail-order-x-z.d: Removed since we will help tp reorder the prefixed extensions for now. * testsuite/gas/riscv/march-fail-order-x-z.l: Likewise. * testsuite/gas/riscv/march-fail-order-x.d: Likewise. * testsuite/gas/riscv/march-fail-order-x.l: Likewise. * testsuite/gas/riscv/march-fail-order-z.d: Likewise. * testsuite/gas/riscv/march-fail-order-z.l: Likewise. --- bfd/elfxx-riscv.c | 23 ------------------- .../gas/riscv/march-fail-order-x-z.d | 3 --- .../gas/riscv/march-fail-order-x-z.l | 2 -- gas/testsuite/gas/riscv/march-fail-order-x.d | 3 --- gas/testsuite/gas/riscv/march-fail-order-x.l | 2 -- gas/testsuite/gas/riscv/march-fail-order-z.d | 3 --- gas/testsuite/gas/riscv/march-fail-order-z.l | 2 -- 7 files changed, 38 deletions(-) delete mode 100644 gas/testsuite/gas/riscv/march-fail-order-x-z.d delete mode 100644 gas/testsuite/gas/riscv/march-fail-order-x-z.l delete mode 100644 gas/testsuite/gas/riscv/march-fail-order-x.d delete mode 100644 gas/testsuite/gas/riscv/march-fail-order-x.l delete mode 100644 gas/testsuite/gas/riscv/march-fail-order-z.d delete mode 100644 gas/testsuite/gas/riscv/march-fail-order-z.l diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index ffc18c97d1e..f920e0ce9ff 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1729,7 +1729,6 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps, { int major_version; int minor_version; - const char *last_name; enum riscv_prefix_ext_class class; while (*p) @@ -1806,28 +1805,6 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps, return NULL; } - /* Check that the extension isn't duplicate. */ - last_name = rps->subset_list->tail->name; - if (!strcasecmp (last_name, subset)) - { - rps->error_handler - (_("%s: duplicate prefixed ISA extension `%s'"), - arch, subset); - free (subset); - return NULL; - } - - /* Check that the extension is in expected order. */ - if (riscv_compare_subsets (last_name, subset) > 0) - { - rps->error_handler - (_("%s: prefixed ISA extension `%s' is not in expected " - "order. It must come before `%s'"), - arch, subset, last_name); - free (subset); - return NULL; - } - riscv_parse_add_subset (rps, subset, major_version, minor_version, false); diff --git a/gas/testsuite/gas/riscv/march-fail-order-x-z.d b/gas/testsuite/gas/riscv/march-fail-order-x-z.d deleted file mode 100644 index 7245e68e0ea..00000000000 --- a/gas/testsuite/gas/riscv/march-fail-order-x-z.d +++ /dev/null @@ -1,3 +0,0 @@ -#as: -march=rv32i_xargle2p0_zicsr2p0 -#source: empty.s -#error_output: march-fail-order-x-z.l diff --git a/gas/testsuite/gas/riscv/march-fail-order-x-z.l b/gas/testsuite/gas/riscv/march-fail-order-x-z.l deleted file mode 100644 index 53ea8201187..00000000000 --- a/gas/testsuite/gas/riscv/march-fail-order-x-z.l +++ /dev/null @@ -1,2 +0,0 @@ -.*Assembler messages: -.*Error: .*prefixed ISA extension `zicsr' is not in expected order. It must come before `xargle' diff --git a/gas/testsuite/gas/riscv/march-fail-order-x.d b/gas/testsuite/gas/riscv/march-fail-order-x.d deleted file mode 100644 index 72a821ef8e6..00000000000 --- a/gas/testsuite/gas/riscv/march-fail-order-x.d +++ /dev/null @@ -1,3 +0,0 @@ -#as: -march=rv32i_xbargle2p0_xargle2p0 -#source: empty.s -#error_output: march-fail-order-x.l diff --git a/gas/testsuite/gas/riscv/march-fail-order-x.l b/gas/testsuite/gas/riscv/march-fail-order-x.l deleted file mode 100644 index cfb118528df..00000000000 --- a/gas/testsuite/gas/riscv/march-fail-order-x.l +++ /dev/null @@ -1,2 +0,0 @@ -.*Assembler messages: -.*Error: .*prefixed ISA extension `xargle' is not in expected order. It must come before `xbargle' diff --git a/gas/testsuite/gas/riscv/march-fail-order-z.d b/gas/testsuite/gas/riscv/march-fail-order-z.d deleted file mode 100644 index dd076c6d35a..00000000000 --- a/gas/testsuite/gas/riscv/march-fail-order-z.d +++ /dev/null @@ -1,3 +0,0 @@ -#as: -march=rv32i_zifencei2p0_zicsr2p0 -#source: empty.s -#error_output: march-fail-order-z.l diff --git a/gas/testsuite/gas/riscv/march-fail-order-z.l b/gas/testsuite/gas/riscv/march-fail-order-z.l deleted file mode 100644 index 468c412051f..00000000000 --- a/gas/testsuite/gas/riscv/march-fail-order-z.l +++ /dev/null @@ -1,2 +0,0 @@ -.*Assembler messages: -.*Error: .*prefixed ISA extension `zicsr' is not in expected order. It must come before `zifencei'