aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-riscv.h
diff options
context:
space:
mode:
authorNelson Chu <nelson.chu@sifive.com>2020-11-20 18:05:05 +0800
committerNelson Chu <nelson.chu@sifive.com>2020-12-01 15:18:48 +0800
commitdfe92496678a200464e54d80e96a608bfea338b9 (patch)
treebdb1591a6dc6f76a781ffaaf2abef7663852f1b4 /bfd/elfxx-riscv.h
parent7ef19aa616aee98f0a5c7c948d0db56a9f3c5e57 (diff)
downloadgdb-dfe92496678a200464e54d80e96a608bfea338b9.zip
gdb-dfe92496678a200464e54d80e96a608bfea338b9.tar.gz
gdb-dfe92496678a200464e54d80e96a608bfea338b9.tar.bz2
RISC-V: Support to add implicit extensions.
We have to parse and add all arch string extensions at first, and then start to add their implicit extensions. That means we can always add arch string extensions at the end of the subset list, but we need to search the right place to add their implicit extensions. For now we follow the following rules to add the implicit extensions, * Add zicsr and zifencei only when the i's version less than 2.1. * Add d, f and zicsr when q is found. * Add f and zicsr when d is found. * Add zicsr when f is found. Besides, we do not add the implicit extensions if they are already added in the subset list, or we cannot find their default versions according to the chosen ISA spec. bfd/ * elfnn-riscv.c (riscv_merge_std_ext): Updated since riscv_lookup_subset is changed. * elfxx-riscv.c (riscv_ext_order): New Array used to compare the extensions' order quickly. (riscv_init_ext_order): New function. Init the riscv_ext_order according to the riscv_supported_std_ext and parse_config[i].class automatically. (riscv_compare_subsets): New function. Similar to the strcmp, but compare the subsets with the specific order. (riscv_lookup_subset): Return TRUE and set `current` to the subset if it is found. Otherwise, return FALSE and set `current` to the place where we should insert the subset. (riscv_add_implicit_subset): New function. Search the list first, and then find the right place to add the implicit_subset. (riscv_parse_add_subset): Since We have to add all arch string extensions first, and then start to add their implicit extensions. We can add arch string extensions in order by the original riscv_add_subset, and then add the implicit subsets by the riscv_add_implicit_subset. Besides, do not add the implicit extensions if we failed to find their default versions. (riscv_parse_std_ext): Updated. (riscv_parse_add_implicit_subsets): New function. Add all implicit extensions according to the arch string extensions. (riscv_parse_subset): Call riscv_init_ext_order and riscv_parse_add_implicit_subsets, before and after parsing the arch string. Remove parts of the ISA conflict checking since the implicit extensions are added. * elfxx-riscv.h (riscv_lookup_subset): Updated. gas/ * config/tc-riscv.c (riscv_subset_supports): Updated. * testsuite/gas/riscv/march-imply-i2p0.d: New testcase. Need to add the implicit zicsr and zifencei when i's version less than 2.1. * testsuite/gas/riscv/march-imply-i2p1.d: New testcase. * testsuite/gas/riscv/march-imply-d.d: Likewise. * testsuite/gas/riscv/march-imply-f.d: Likewise. * testsuite/gas/riscv/march-imply-q.d: Likewise. * testsuite/gas/riscv/march-fail-rv32iq.l: Updated. * testsuite/gas/riscv/march-fail-rv32id.d: Removed. * testsuite/gas/riscv/march-fail-rv32id.l: Likewise. * testsuite/gas/riscv/march-fail-rv64iq.d: Likewise. * testsuite/gas/riscv/march-fail-rv64iq.l: Likewise.
Diffstat (limited to 'bfd/elfxx-riscv.h')
-rw-r--r--bfd/elfxx-riscv.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h
index 45705ce..89d4abb 100644
--- a/bfd/elfxx-riscv.h
+++ b/bfd/elfxx-riscv.h
@@ -60,9 +60,10 @@ riscv_add_subset (riscv_subset_list_t *,
const char *,
int, int);
-extern riscv_subset_t *
+extern bfd_boolean
riscv_lookup_subset (const riscv_subset_list_t *,
- const char *);
+ const char *,
+ riscv_subset_t **);
typedef struct
{