RISC-V: Change -march parsing.
authorJim Wilson <jimw@sifive.com>
Thu, 23 Jan 2020 00:45:04 +0000 (16:45 -0800)
committerJim Wilson <jimw@sifive.com>
Thu, 23 Jan 2020 00:45:04 +0000 (16:45 -0800)
commit403d1bd91dffc9e6f5029faaa9cce7c07f268d52
tree1a525aaec23a2bd690a82baaed978513c1e5261b
parent3401347452ff7d23e148fdb07e4d49a57304ac14
RISC-V: Change -march parsing.

bfd/
2020-01-22  Maxim Blinov  <maxim.blinov@embecosm.com>
* bfd/elfnn-riscv.c (riscv_skip_prefix): New.
(riscv_prefix_cmp): Likewise.
(riscv_non_std_ext_p): Deleted.
(riscv_std_sv_ext_p): Likewise.
(riscv_non_std_sv_ext_p): Likewise.
(riscv_merge_non_std_and_sv_ext): Rename to...
(riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
(riscv_merge_arch_attr_info): Replace 3 calls to
riscv_merge_non_std_and_sv_ext with single call to
riscv_merge_multi_letter_ext.
* bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
encounter a 'z' prefix.
(riscv_get_prefix_class): New function, return prefix class based
on first few characters of input string.
(riscv_parse_config): New structure to factor out minor differences
in extension class parsing behaviour.
(riscv_parse_sv_or_non_std_ext): Rename to...
(riscv_parse_prefixed_ext): and parameterise with
riscv_parse_config.
(riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
(riscv_multi_letter_ext_valid_p): New.
(riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
(riscv_parse_subset): Delegate all non-single-letter parsing work
to riscv_parse_prefixed_ext.
* bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
(riscv_get_prefix_class): Declare.

gas/
2020-01-22  Maxim Blinov  <maxim.blinov@embecosm.com>
* testsuite/gas/riscv/march-ok-s.d: sx is no longer valid and
s exts must be known, so rename *ok* to *fail*.
* testsuite/gas/riscv/march-ok-sx.d: Likewise.
* testsuite/gas/riscv/march-ok-s-with-version: Likewise.
* testsuite/gas/riscv/march-fail-s.l: Expected error messages for
above change.
* testsuite/gas/riscv/march-fail-sx.l: Likewise.
* testsuite/gas/riscv/march-fail-sx-with-version.l: Likewise.

Change-Id: Ic4d91a13d055a10d30ab28752a380a669b59f29c
15 files changed:
bfd/ChangeLog
bfd/elfnn-riscv.c
bfd/elfxx-riscv.c
bfd/elfxx-riscv.h
gas/ChangeLog
gas/testsuite/gas/riscv/march-fail-s-with-version [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-s-with-version.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-s-with-version.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-s.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-s.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-sx.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-fail-sx.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-ok-s-with-version.d [deleted file]
gas/testsuite/gas/riscv/march-ok-s.d [deleted file]
gas/testsuite/gas/riscv/march-ok-sx.d [deleted file]