diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index ee96608358e..eaf496649db 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1946,6 +1946,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)) { diff --git a/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d new file mode 100644 index 00000000000..1b70a9e280f --- /dev/null +++ b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d @@ -0,0 +1,3 @@ +#as: -march=rv64i_zcf +#source: empty.s +#error_output: march-fail-rv64i_zcf.l diff --git a/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l new file mode 100644 index 00000000000..b9e07c64d52 --- /dev/null +++ b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*Error: .*rv64 does not support the `zcf' extension