Skip to content

Commit

Permalink
RISC-V: Prohibit the 'Zcf' extension on RV64
Browse files Browse the repository at this point in the history
As per:
<riscvarchive/riscv-code-size-reduction#221>,
the 'Zcf' extension does not exist on RV64.  This is reflected on the
version 1.0.4-1 of the code size reduction specification:
<https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.4-1>.

This commit prohibits the combination: RV64 (or any ISA with XLEN > 32)
and the 'Zcf' extension.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_parse_check_conflicts): Prohibit
	combination of RV64 and 'Zcf'.

gas/ChangeLog:

	* testsuite/gas/riscv/march-fail-rv64i_zcf.d: New test.
	* testsuite/gas/riscv/march-fail-rv64i_zcf.l: Likewise.
  • Loading branch information
a4lg authored and ouuleilei-bot committed Jul 24, 2023
1 parent 324998b commit aa98d89
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bfd/elfxx-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,13 @@ riscv_parse_check_conflicts (riscv_parse_subset_t *rps)
rps->error_handler (_("rv%d does not support the `q' extension"), xlen);
no_conflict = false;
}
if (riscv_lookup_subset (rps->subset_list, "zcf", &subset)
&& xlen > 32)
{
rps->error_handler
(_("rv%d does not support the `zcf' extension"), xlen);
no_conflict = false;
}
if (riscv_lookup_subset (rps->subset_list, "zfinx", &subset)
&& riscv_lookup_subset (rps->subset_list, "f", &subset))
{
Expand Down
3 changes: 3 additions & 0 deletions gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#as: -march=rv64i_zcf
#source: empty.s
#error_output: march-fail-rv64i_zcf.l
2 changes: 2 additions & 0 deletions gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.*Assembler messages:
.*Error: .*rv64 does not support the `zcf' extension

0 comments on commit aa98d89

Please sign in to comment.