diff options
author | Nelson Chu <nelson.chu@sifive.com> | 2020-11-20 15:35:17 +0800 |
---|---|---|
committer | Nelson Chu <nelson.chu@sifive.com> | 2020-12-01 15:11:30 +0800 |
commit | 5a1b31e1e1cee6e9f1c92abff59cdcfff0dddf30 (patch) | |
tree | d531eba64273f93e572e27c610ddab9013bd0389 /bfd | |
parent | e8d4709e6a5f4e3fad8479b8069c52294be54488 (diff) | |
download | gdb-5a1b31e1e1cee6e9f1c92abff59cdcfff0dddf30.zip gdb-5a1b31e1e1cee6e9f1c92abff59cdcfff0dddf30.tar.gz gdb-5a1b31e1e1cee6e9f1c92abff59cdcfff0dddf30.tar.bz2 |
RISC-V: Add zifencei and prefixed h class extensions.
bfd/
* elfxx-riscv.c (riscv_parse_std_ext): Stop parsing standard
extensions when parsed h keyword.
(riscv_get_prefix_class): Support prefixed h class.
(riscv_std_h_ext_strtab): Likewise.
(riscv_ext_h_valid_p): Likewise.
(parse_config): Likewise.
(riscv_std_z_ext_strtab): Add zifencei.
* elfxx-riscv.h (riscv_isa_ext_class): Add RV_ISA_CLASS_H.
gas/
* testsuite/gas/riscv/march-fail-order-z.d: New testcase, check
orders of prefixed z extensions.
* testsuite/gas/riscv/march-fail-order-z.l: Likewise.
* testsuite/gas/riscv/march-fail-single-char-h.d: New testcase.
* testsuite/gas/riscv/march-fail-single-char.l: Updated.
* testsuite/gas/riscv/march-fail-unknown-h.d: New testcase.
* testsuite/gas/riscv/march-fail-unknown.l: Updated.
opcodes/
* riscv-opc.c (riscv_ext_version_table): Add zifencei.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/elfxx-riscv.c | 21 | ||||
-rw-r--r-- | bfd/elfxx-riscv.h | 1 |
3 files changed, 31 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3ac2719..726a377 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,16 @@ 2020-12-01 Nelson Chu <nelson.chu@sifive.com> + * elfxx-riscv.c (riscv_parse_std_ext): Stop parsing standard + extensions when parsed h keyword. + (riscv_get_prefix_class): Support prefixed h class. + (riscv_std_h_ext_strtab): Likewise. + (riscv_ext_h_valid_p): Likewise. + (parse_config): Likewise. + (riscv_std_z_ext_strtab): Add zifencei. + * elfxx-riscv.h (riscv_isa_ext_class): Add RV_ISA_CLASS_H. + +2020-12-01 Nelson Chu <nelson.chu@sifive.com> + * elfxx-riscv.c (riscv_parse_subset): ISA string cannot contain any uppercase letter. diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 69f3a43..24eafcd 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1225,7 +1225,7 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps, while (p != NULL && *p != '\0') { - if (*p == 'x' || *p == 's' || *p == 'z') + if (*p == 'x' || *p == 's' || *p == 'h' || *p == 'z') break; if (*p == '_') @@ -1281,6 +1281,7 @@ riscv_get_prefix_class (const char *arch) switch (*arch) { case 's': return RV_ISA_CLASS_S; + case 'h': return RV_ISA_CLASS_H; case 'x': return RV_ISA_CLASS_X; case 'z': return RV_ISA_CLASS_Z; default: return RV_ISA_CLASS_UNKNOWN; @@ -1362,6 +1363,7 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps, /* Check that the prefix extension is known. For 'x', anything goes but it cannot simply be 'x'. For 's', it must be known from a list and cannot simply be 's'. + For 'h', it must be known from a list and cannot simply be 'h'. For 'z', it must be known from a list and cannot simply be 'z'. */ /* Check that the extension name is well-formed. */ @@ -1432,7 +1434,7 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps, static const char * const riscv_std_z_ext_strtab[] = { - "zicsr", NULL + "zicsr", "zifencei", NULL }; static const char * const riscv_std_s_ext_strtab[] = @@ -1440,6 +1442,11 @@ static const char * const riscv_std_s_ext_strtab[] = NULL }; +static const char * const riscv_std_h_ext_strtab[] = +{ + NULL +}; + /* For the extension `ext`, search through the list of known extensions `known_exts` for a match, and return TRUE if found. */ @@ -1486,12 +1493,22 @@ riscv_ext_s_valid_p (const char *arg) return riscv_multi_letter_ext_valid_p (arg, riscv_std_s_ext_strtab); } +/* Predicator function for 'h' prefixed extensions. + Only known h-extensions are permitted. */ + +static bfd_boolean +riscv_ext_h_valid_p (const char *arg) +{ + return riscv_multi_letter_ext_valid_p (arg, riscv_std_h_ext_strtab); +} + /* Parsing order of the prefixed extensions that is specified by the ISA spec. */ static const riscv_parse_config_t parse_config[] = { {RV_ISA_CLASS_S, "s", riscv_ext_s_valid_p}, + {RV_ISA_CLASS_H, "h", riscv_ext_h_valid_p}, {RV_ISA_CLASS_Z, "z", riscv_ext_z_valid_p}, {RV_ISA_CLASS_X, "x", riscv_ext_x_valid_p}, {RV_ISA_CLASS_UNKNOWN, NULL, NULL} diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h index b5b17d1..6b7cc5b 100644 --- a/bfd/elfxx-riscv.h +++ b/bfd/elfxx-riscv.h @@ -102,6 +102,7 @@ riscv_estimate_digit (unsigned); typedef enum riscv_isa_ext_class { RV_ISA_CLASS_S, + RV_ISA_CLASS_H, RV_ISA_CLASS_Z, RV_ISA_CLASS_X, RV_ISA_CLASS_UNKNOWN |