RISC-V: Accept version, supervisor ext and more than one NSE for -march.
authorJim Wilson <jimw@sifive.com>
Mon, 3 Dec 2018 21:59:44 +0000 (13:59 -0800)
committerJim Wilson <jimw@sifive.com>
Mon, 3 Dec 2018 22:05:17 +0000 (14:05 -0800)
commit1080bf78c05b220f5f4bbc5c50d6a0ef6490d738
tree13e723b5e05e1858e2208b713d5bf94b38801439
parent57b64c4103ffeadd524eb80b4a7d61be8c8ec871
RISC-V: Accept version, supervisor ext and more than one NSE for -march.

This patch moves all -march parsing logic into bfd, because we will use this
code in ELF attributes.

bfd/
* elfxx-riscv.h (RISCV_DONT_CARE_VERSION): New macro.
(struct riscv_subset_t): New structure.
(riscv_subset_t): New typedef.
(riscv_subset_list_t): New structure.
(riscv_release_subset_list): New prototype.
(riscv_add_subset): Likewise.
(riscv_lookup_subset): Likewise.
(riscv_lookup_subset_version): Likewise.
(riscv_release_subset_list): Likewise.
* elfxx-riscv.c: Include safe-ctype.h.
(riscv_parsing_subset_version): New function.
(riscv_supported_std_ext): Likewise.
(riscv_parse_std_ext): Likewise.
(riscv_parse_sv_or_non_std_ext): Likewise.
(riscv_parse_subset): Likewise.
(riscv_add_subset): Likewise.
(riscv_lookup_subset): Likewise.
(riscv_lookup_subset_version): Likewise.
(riscv_release_subset_list): Likewise.
gas/
* config/tc-riscv.c: Include elfxx-riscv.h.
(struct riscv_subset): Removed.
(riscv_subsets): Change type to riscv_subset_list_t.
(riscv_subset_supports): Removed argument: xlen_required and move
logic into libbfd.
(riscv_multi_subset_supports): Removed argument: xlen_required.
(riscv_clear_subsets): Removed.
(riscv_add_subset): Ditto.
(riscv_set_arch): Extract parsing logic into libbfd.
(riscv_ip): Update argument for riscv_multi_subset_supports and
riscv_subset_supports. Update riscv_subsets due to struct definition
changed.
(riscv_after_parse_args): Update riscv_subsets due to struct
definition changed, update and argument for riscv_subset_supports.
* testsuite/gas/riscv/empty.s: New.
* testsuite/gas/riscv/march-fail-rv32ef.d: Likewise.
* testsuite/gas/riscv/march-fail-rv32ef.l: Likewise.
* testsuite/gas/riscv/march-fail-rv32i.d: Likewise.
* testsuite/gas/riscv/march-fail-rv32i.l: Likewise.
* testsuite/gas/riscv/march-fail-rv32iam.d: Likewise.
* testsuite/gas/riscv/march-fail-rv32iam.l: Likewise.
* testsuite/gas/riscv/march-fail-rv32ic.d: Likewise.
* testsuite/gas/riscv/march-fail-rv32ic.l: Likewise.
* testsuite/gas/riscv/march-fail-rv32icx2p.d: Likewise.
* testsuite/gas/riscv/march-fail-rv32icx2p.l: Likewise.
* testsuite/gas/riscv/march-fail-rv32imc.d: Likewise.
* testsuite/gas/riscv/march-fail-rv32imc.l: Likewise.
* testsuite/gas/riscv/march-fail-rv64I.d: Likewise.
* testsuite/gas/riscv/march-fail-rv64I.l: Likewise.
* testsuite/gas/riscv/march-fail-rv64e.d: Likewise.
* testsuite/gas/riscv/march-fail-rv64e.l: Likewise.
* testsuite/gas/riscv/march-ok-g2.d: Likewise.
* testsuite/gas/riscv/march-ok-g2p0.d: Likewise.
* testsuite/gas/riscv/march-ok-i2p0.d: Likewise.
* testsuite/gas/riscv/march-ok-nse-with-version.: Likewise.d
* testsuite/gas/riscv/march-ok-s-with-version.d: Likewise.
* testsuite/gas/riscv/march-ok-s.d: Likewise.
* testsuite/gas/riscv/march-ok-sx.d: Likewise.
* testsuite/gas/riscv/march-ok-two-nse.d: Likewise.
* testsuite/gas/riscv/march-ok-g2_p1.d: Likewise.
* testsuite/gas/riscv/march-ok-i2p0m2_a2f2.d: Likewise.
include/
* opcode/riscv.h (riscv_opcode): Change type of xlen_requirement to
unsigned.
opcodes/
* riscv-opc.c: Change the type of xlen, because type of
xlen_requirement changed.
36 files changed:
bfd/ChangeLog
bfd/elfxx-riscv.c
bfd/elfxx-riscv.h
gas/ChangeLog
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/empty.s [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32ef.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32ef.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32i.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32i.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32iam.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32iam.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32ic.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32ic.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32icx2p.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32icx2p.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32imc.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv32imc.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv64I.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv64I.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv64e.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-rv64e.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-g2.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-g2_p1.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-g2p0.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-i2p0.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-i2p0m2_a2f2.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-nse-with-version.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-s-with-version.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-s.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-sx.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-two-nse.d [new file with mode: 0644]
include/ChangeLog
include/opcode/riscv.h
opcodes/ChangeLog
opcodes/riscv-dis.c