Skip to content

Commit 8c28834

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 404def8 commit 8c28834

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
@@ -1022,6 +1022,8 @@ riscv_csr_address (const char *csr_name,
10221022
bool need_check_version = false;
10231023
bool is_rv32_only = false;
10241024
bool is_h_required = false;
1025+
bool is_csr_req_complex = false;
1026+
bool csr_ok = false;
10251027
const char* extension = NULL;
10261028

10271029
switch (csr_class)
@@ -1115,8 +1117,10 @@ riscv_csr_address (const char *csr_name,
11151117
if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h"))
11161118
as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name);
11171119

1118-
if (extension != NULL
1119-
&& !riscv_subset_supports (&riscv_rps_as, extension))
1120+
if (is_csr_req_complex
1121+
? !csr_ok
1122+
: (extension != NULL
1123+
&& !riscv_subset_supports (&riscv_rps_as, extension)))
11201124
as_warn (_("invalid CSR `%s', needs `%s' extension"),
11211125
csr_name, extension);
11221126
}

0 commit comments

Comments
 (0)