RISC-V: Relax the order checking for the architecture string
authorNelson Chu <nelson@rivosinc.com>
Wed, 21 Dec 2022 03:22:06 +0000 (11:22 +0800)
committerNelson Chu <nelson@rivosinc.com>
Fri, 23 Dec 2022 02:00:37 +0000 (10:00 +0800)
commitfa6f3b911fedef433c92b65798638c04ad7556d1
tree9815b2f38241dbbe3b758ed47f151e329dbb4cfa
parent11e25f766e533b77538b2618b4ef3e2bc2fb5780
RISC-V: Relax the order checking for the architecture string

* riscv-toolchain-conventions,
PR, https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/14
Issue, https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/11

* Refer to the commit afc41ffb,
RISC-V: Reorder the prefixed extensions which are out of order.

In the past we only allow to reorder the prefixed extensions.  But according
to the PR 14 in the riscv-toolchain-convention, we can also relax the order
checking to allow the whole extensions be written out of orders, including
the single standard extensions and the prefixed multi-letter extensions.
Just that we still need to follow the following rules as usual,

1. prefixed extensions need to be seperated with `_'.
2. prefixed extensions need complete <major>.<minor> version if set.

Please see the details in the march-ok-reorder gas testcase.

Passed the riscv-gnu-toolchain regressions.

bfd/
    * elfxx-riscv.c (enum riscv_prefix_ext_class): Changed RV_ISA_CLASS_UNKNOWN
    to RV_ISA_CLASS_SINGLE, since everything that does not belong to the
    multi-keyword will possible be a single extension for the current parser.
    (parse_config): Likewise.
    (riscv_get_prefix_class): Likewise.
    (riscv_compare_subsets): Likewise.
    (riscv_parse_std_ext): Removed, and merged with riscv_parse_prefixed_ext
    into riscv_parse_extensions.
    (riscv_parse_prefixed_ext): Likewise.
    (riscv_parse_subset): Only need to call riscv_parse_extensions to parse
    both single standard and prefixed extensions.
gas/
    * testsuite/gas/riscv/march-fail-order-std.d: Removed since the relaxed
    order checking.
    * testsuite/gas/riscv/march-fail-order-std.l: Likewise.
    * testsuite/gas/riscv/march-fail-order-x-std.d: Likewise.
    * testsuite/gas/riscv/march-fail-order-z-std.d: Likewise.
    * testsuite/gas/riscv/march-fail-order-zx-std.l: Likewise.
    * testsuite/gas/riscv/march-fail-unknown-std.l: Updated.
    * testsuite/gas/riscv/march-ok-reorder.d: New testcase.
bfd/elfxx-riscv.c
gas/testsuite/gas/riscv/march-fail-order-std.d [deleted file]
gas/testsuite/gas/riscv/march-fail-order-std.l [deleted file]
gas/testsuite/gas/riscv/march-fail-order-x-std.d [deleted file]
gas/testsuite/gas/riscv/march-fail-order-z-std.d [deleted file]
gas/testsuite/gas/riscv/march-fail-order-zx-std.l [deleted file]
gas/testsuite/gas/riscv/march-fail-unknown-std.l
gas/testsuite/gas/riscv/march-ok-reorder.d [new file with mode: 0644]