Skip to content

Commit 7d9371b

Browse files
committed
RISC-V: Add complex CSR error handling
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.
1 parent a1c1b5b commit 7d9371b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gas/config/tc-riscv.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,8 @@ riscv_csr_address (const char *csr_name,
10261026
bool need_check_version = false;
10271027
bool is_rv32_only = false;
10281028
bool is_h_required = false;
1029+
bool is_csr_req_complex = false;
1030+
bool csr_ok = false;
10291031
const char* extension = NULL;
10301032

10311033
switch (csr_class)
@@ -1131,8 +1133,10 @@ riscv_csr_address (const char *csr_name,
11311133
if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h"))
11321134
as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name);
11331135

1134-
if (extension != NULL
1135-
&& !riscv_subset_supports (&riscv_rps_as, extension))
1136+
if (is_csr_req_complex
1137+
? !csr_ok
1138+
: (extension != NULL
1139+
&& !riscv_subset_supports (&riscv_rps_as, extension)))
11361140
as_warn (_("invalid CSR `%s', needs `%s' extension"),
11371141
csr_name, extension);
11381142
}

0 commit comments

Comments
 (0)