Skip to content

Commit

Permalink
RISC-V: Add complex CSR error handling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
a4lg committed Aug 15, 2023
1 parent 94c835e commit 07f4741
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gas/config/tc-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,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)
Expand Down Expand Up @@ -1122,8 +1124,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);
}
Expand Down

0 comments on commit 07f4741

Please sign in to comment.