[REVIEW ONLY 1/2] RISC-V: Add complex CSR error handling
Tsukasa OI
research_trasio@irq.a4lg.com
Fri Aug 11 02:39:12 GMT 2023
From: Tsukasa OI <research_trasio@irq.a4lg.com>
This commit adds template for complex CSR error handling (such like
multiple extensions involved).
gas/ChangeLog:
* config/tc-riscv.c (riscv_csr_address): Add complex CSR error
handling.
---
gas/config/tc-riscv.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index aaf8b9be64fd..91c449596749 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -1020,6 +1020,8 @@ riscv_csr_address (const char *csr_name,
bool need_check_version = false;
bool is_rv32_only = false;
bool is_h_required = false;
+ bool is_csr_req_complex = false;
+ bool csr_ok = false;
const char* extension = NULL;
switch (csr_class)
@@ -1106,8 +1108,10 @@ riscv_csr_address (const char *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))
+ if (is_csr_req_complex
+ ? !csr_ok
+ : (extension != NULL
+ && !riscv_subset_supports (&riscv_rps_as, extension)))
as_warn (_("invalid CSR `%s', needs `%s' extension"),
csr_name, extension);
}
--
2.41.0
More information about the Binutils
mailing list