RISC-V: Allow to add numbers in the prefixed extension names.
authorNelson Chu <nelson.chu@sifive.com>
Tue, 28 Sep 2021 08:47:23 +0000 (16:47 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Tue, 28 Sep 2021 11:39:12 +0000 (19:39 +0800)
commit69a61890cb94746e5a564776081c3cefa8fca408
treeed6d38097517c5b08a1af465815426a3733fc2e9
parent91f2597bd24d171c1337a4629f8237aa47c59082
RISC-V: Allow to add numbers in the prefixed extension names.

We need to allow adding numbers in the prefixed extension names, since
the zve<32,64><d,f,x> extensions are included in the forzen rvv v1.0 spec
recently.  But there are two restrictions as follows,

* The extension name ends with <number>p is invalid, since this may
be confused with extension with <number>.0 version.  We report errors
for this case.

Invalid format: [z|h|s|zvm|x][0-9a-z]+[0-9]+p

* The extension name ends with numbers is valid, but the numbers will
be parsed as major version, so try to avoid naming extensions like this.

bfd/
* elfxx-riscv.c (riscv_recognized_prefixed_ext): Renamed from
riscv_valid_prefixed_ext/
(riscv_parsing_subset_version): The extensions end with <number>p
is forbidden, we already report the detailed errors in the
riscv_parse_prefixed_ext, so clean the code and unused parameters.
(riscv_parse_std_ext): Updated.
(riscv_parse_prefixed_ext): Rewrite the parser to allow numbers
in the prefixed extension names.
gas/
* testsuite/gas/riscv/march-fail-invalid-x-01.d: New testcases.
* testsuite/gas/riscv/march-fail-invalid-x-02.d: Likewise.
* testsuite/gas/riscv/march-fail-invalid-z-01.d: Likewise.
* testsuite/gas/riscv/march-fail-invalid-z-02.d: Likewise.
* testsuite/gas/riscv/march-fail-invalid.l: Likewise.
* testsuite/gas/riscv/march-fail-version-x.d: Removed.
* testsuite/gas/riscv/march-fail-version-z.d: Likewise.
* testsuite/gas/riscv/march-fail-version.l: Likewise.
bfd/elfxx-riscv.c
gas/testsuite/gas/riscv/march-fail-invalid-x-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-invalid-x-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-invalid-z-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-invalid-z-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-invalid.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-version-x.d [deleted file]
gas/testsuite/gas/riscv/march-fail-version-z.d [deleted file]
gas/testsuite/gas/riscv/march-fail-version.l [deleted file]