RISC-V: Minor updates for architecture parser.
authorNelson Chu <nelson.chu@sifive.com>
Tue, 20 Jul 2021 03:42:09 +0000 (11:42 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Tue, 20 Jul 2021 10:04:44 +0000 (18:04 +0800)
commitcb959bd8956f9dfc39f7f9a5ee56c1606979d33e
tree735ea190d0e8420f46bd130bd98e40f670e77811
parentc2a76217711775caf1e404e8fd1eeb3fbac4d2db
RISC-V: Minor updates for architecture parser.

* Two add subset functions is redundant.  Keep the riscv_add_implicit_subset,
and renamed it to riscv_add_subset.  Besides, if the subset is added in order,
then we just add it at the tail of the subset list.

* Removed the "-march:" prefix from the error messages.  Since not only the
-march= option will use the parser, but also the architecture elf attributes,
the default architecture setting and linker will use the same parser.

* Use a function, riscv_parse_check_conflicts, to check the conflicts
of extensions, including the rv64e and rv32q.

The rv32emc-elf/rv32i-elf/rv32gc-linux/rv64gc-elf/rv64gc-linux regressions
are tested and passed.

bfd/
* elfxx-riscv.c (riscv_lookup_subset): Check the subset tail list
first.  If the subset is added in order, then we can just add it to
the tail without searching the whole list.
(riscv_add_subset): Replaced by riscv_add_implicit_subset.
(riscv_add_implicit_subset): Renamed to riscv_add_subset.
(riscv_parse_add_subset): Updated.
(riscv_parsing_subset_version): Removed the "-march:" prefix from
the error message.
(riscv_parse_prefixed_ext): Likewise.
(riscv_parse_std_ext): Likewise.  And move the rv<xlen>e check
to riscv_parse_check_conflicts.
(riscv_parse_check_conflicts): New function used to check conflicts.
(riscv_parse_subset): Updated.
gas/
* testsuite/gas/riscv/march-fail-base-02.l: Updated.
* testsuite/gas/riscv/march-fail-unknown-std.l: Likewise.
bfd/elfxx-riscv.c
gas/testsuite/gas/riscv/march-fail-base-02.l
gas/testsuite/gas/riscv/march-fail-unknown-std.l