diff options
author | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-06-24 11:51:53 +0900 |
---|---|---|
committer | Nelson Chu <nelson.chu@sifive.com> | 2022-06-28 09:05:54 +0800 |
commit | 39590abd658b9d7322ed8c54b784f00aca749e03 (patch) | |
tree | fd4a5a4a328a42de01d75bf54b4d48bc2b92e307 /gas | |
parent | 8bddb52eb97bbfd70f95447810f69c803b01e7b7 (diff) | |
download | gdb-39590abd658b9d7322ed8c54b784f00aca749e03.zip gdb-39590abd658b9d7322ed8c54b784f00aca749e03.tar.gz gdb-39590abd658b9d7322ed8c54b784f00aca749e03.tar.bz2 |
RISC-V: Add new CSR feature gate handling (RV32,H)
To support feature gate like Smstateen && H, this commit adds certain
CSR feature gate handling. It also changes how RV32-only CSRs are
handled for cleanliness.
gas/ChangeLog:
* config/tc-riscv.c (riscv_csr_address): Add CSR feature gate
handling for H. Change handling on RV32.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-riscv.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 6b04dc9..6c5938b 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -899,20 +899,21 @@ riscv_csr_address (const char *csr_name, struct riscv_csr_extra *saved_entry = entry; enum riscv_csr_class csr_class = entry->csr_class; bool need_check_version = false; - bool rv32_only = true; + bool is_rv32_only = false; + bool is_h_required = false; const char* extension = NULL; switch (csr_class) { case CSR_CLASS_I_32: - rv32_only = (xlen == 32); + is_rv32_only = true; /* Fall through. */ case CSR_CLASS_I: need_check_version = true; extension = "i"; break; case CSR_CLASS_H_32: - rv32_only = (xlen == 32); + is_rv32_only = true; /* Fall through. */ case CSR_CLASS_H: extension = "h"; @@ -934,8 +935,10 @@ riscv_csr_address (const char *csr_name, if (riscv_opts.csr_check) { - if (!rv32_only) + if (is_rv32_only && xlen != 32) as_warn (_("invalid CSR `%s', needs rv32i extension"), csr_name); + if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h")) + as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name); if (extension != NULL && !riscv_subset_supports (&riscv_rps_as, extension)) |