aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-riscv.h
diff options
context:
space:
mode:
authorJim Wilson <jimw@sifive.com>2020-01-22 16:45:04 -0800
committerJim Wilson <jimw@sifive.com>2020-01-22 16:45:04 -0800
commit403d1bd91dffc9e6f5029faaa9cce7c07f268d52 (patch)
tree1a525aaec23a2bd690a82baaed978513c1e5261b /bfd/elfxx-riscv.h
parent3401347452ff7d23e148fdb07e4d49a57304ac14 (diff)
downloadgdb-403d1bd91dffc9e6f5029faaa9cce7c07f268d52.zip
gdb-403d1bd91dffc9e6f5029faaa9cce7c07f268d52.tar.gz
gdb-403d1bd91dffc9e6f5029faaa9cce7c07f268d52.tar.bz2
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
Diffstat (limited to 'bfd/elfxx-riscv.h')
-rw-r--r--bfd/elfxx-riscv.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h
index 3ae549f..76ee274 100644
--- a/bfd/elfxx-riscv.h
+++ b/bfd/elfxx-riscv.h
@@ -86,3 +86,20 @@ riscv_release_subset_list (riscv_subset_list_t *);
extern char *
riscv_arch_str (unsigned, const riscv_subset_list_t *);
+
+/* ISA extension name class. E.g. "zbb" corresponds to RV_ISA_CLASS_Z,
+ "xargs" corresponds to RV_ISA_CLASS_X, etc. Order is important
+ here. */
+
+typedef enum riscv_isa_ext_class
+ {
+ RV_ISA_CLASS_S,
+ RV_ISA_CLASS_Z,
+ RV_ISA_CLASS_X,
+ RV_ISA_CLASS_UNKNOWN
+ } riscv_isa_ext_class_t;
+
+/* Classify the argument 'ext' into one of riscv_isa_ext_class_t. */
+
+riscv_isa_ext_class_t
+riscv_get_prefix_class (const char *);