Skip to content

Commit 27bf4bf

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 11d9ed4 commit 27bf4bf

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
@@ -1024,6 +1024,8 @@ riscv_csr_address (const char *csr_name,
10241024
bool need_check_version = false;
10251025
bool is_rv32_only = false;
10261026
bool is_h_required = false;
1027+
bool is_csr_req_complex = false;
1028+
bool csr_ok = false;
10271029
const char* extension = NULL;
10281030

10291031
switch (csr_class)
@@ -1122,8 +1124,10 @@ riscv_csr_address (const char *csr_name,
11221124
if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h"))
11231125
as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name);
11241126

1125-
if (extension != NULL
1126-
&& !riscv_subset_supports (&riscv_rps_as, extension))
1127+
if (is_csr_req_complex
1128+
? !csr_ok
1129+
: (extension != NULL
1130+
&& !riscv_subset_supports (&riscv_rps_as, extension)))
11271131
as_warn (_("invalid CSR `%s', needs `%s' extension"),
11281132
csr_name, extension);
11291133
}

0 commit comments

Comments
 (0)