Skip to content

Commit beb3c11

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 2d7f310 commit beb3c11

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
@@ -1020,6 +1020,8 @@ riscv_csr_address (const char *csr_name,
10201020
bool need_check_version = false;
10211021
bool is_rv32_only = false;
10221022
bool is_h_required = false;
1023+
bool is_csr_req_complex = false;
1024+
bool csr_ok = false;
10231025
const char* extension = NULL;
10241026

10251027
switch (csr_class)
@@ -1106,8 +1108,10 @@ riscv_csr_address (const char *csr_name,
11061108
if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h"))
11071109
as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name);
11081110

1109-
if (extension != NULL
1110-
&& !riscv_subset_supports (&riscv_rps_as, extension))
1111+
if (is_csr_req_complex
1112+
? !csr_ok
1113+
: (extension != NULL
1114+
&& !riscv_subset_supports (&riscv_rps_as, extension)))
11111115
as_warn (_("invalid CSR `%s', needs `%s' extension"),
11121116
csr_name, extension);
11131117
}

0 commit comments

Comments
 (0)