[PATCH] RISC-V: Fix missing instruction classes in error messages
Nelson Chu
nelson@rivosinc.com
Thu Nov 6 00:57:24 GMT 2025
Thanks, looks good, so committed after passing rv32/64-elf/linux binutils
testsuites.
Nelson
On Wed, Nov 5, 2025 at 10:20 AM Jerry Zhang Jian via Binutils <
binutils@sourceware.org> wrote:
> Add 6 missing instruction class cases to riscv_multi_subset_supports_ext()
> to provide proper extension names in error messages instead of producing
> "internal: unreachable INSN_CLASS_*" errors.
>
> These instruction classes exist in riscv_multi_subset_supports() but were
> missing from riscv_multi_subset_supports_ext(), causing the assembler to
> produce internal errors when instructions are used without the required
> -march specification.
>
> Missing classes added:
> - INSN_CLASS_ZABHA_AND_ZACAS (zabha and zacas)
> - INSN_CLASS_XVENTANACONDOPS (xventanacondops)
> - INSN_CLASS_XSFVCP (xsfvcp)
> - INSN_CLASS_XSFVQMACCQOQ (xsfvqmaccqoq)
> - INSN_CLASS_XSFVQMACCDOD (xsfvqmaccdod)
> - INSN_CLASS_XSFVFNRCLIPXFQF (xsfvfnrclipxfqf)
>
> Before this fix:
> Error: internal: unreachable INSN_CLASS_*
> Error: unrecognized opcode `amocas.b a0,a1,(a2)'
>
> After this fix:
> Error: unrecognized opcode `amocas.b a0,a1,(a2)', extension `zabha' and
> `zacas' required
>
> bfd/
> * elfxx-riscv.c (riscv_multi_subset_supports_ext): Add 6
> missing instruction class cases.
>
> Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
> ---
> bfd/elfxx-riscv.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index 085d77923a0..3b92fbed5f0 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -3128,6 +3128,15 @@ riscv_multi_subset_supports_ext
> (riscv_parse_subset_t *rps,
> return "zabha";
> case INSN_CLASS_ZACAS:
> return "zacas";
> + case INSN_CLASS_ZABHA_AND_ZACAS:
> + if (!riscv_subset_supports (rps, "zabha"))
> + {
> + if (!riscv_subset_supports (rps, "zacas"))
> + return _ ("zabha' and `zacas");
> + else
> + return "zabha";
> + }
> + return "zacas";
> case INSN_CLASS_ZALRSC:
> return "zalrsc";
> case INSN_CLASS_ZAWRS:
> @@ -3341,8 +3350,18 @@ riscv_multi_subset_supports_ext
> (riscv_parse_subset_t *rps,
> return "xtheadvdot";
> case INSN_CLASS_XTHEADZVAMO:
> return "xtheadzvamo";
> + case INSN_CLASS_XVENTANACONDOPS:
> + return "xventanacondops";
> + case INSN_CLASS_XSFVCP:
> + return "xsfvcp";
> case INSN_CLASS_XSFCEASE:
> return "xsfcease";
> + case INSN_CLASS_XSFVQMACCQOQ:
> + return "xsfvqmaccqoq";
> + case INSN_CLASS_XSFVQMACCDOD:
> + return "xsfvqmaccdod";
> + case INSN_CLASS_XSFVFNRCLIPXFQF:
> + return "xsfvfnrclipxfqf";
> default:
> rps->error_handler
> (_("internal: unreachable INSN_CLASS_*"));
> --
> 2.51.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20251106/ff392dc6/attachment.htm>
More information about the Binutils
mailing list