From: Jerry Zhang Jian Date: Wed, 5 Nov 2025 02:18:20 +0000 (+0800) Subject: RISC-V: Fix missing instruction classes in error messages X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c4cf28243297b55976db28230bb2f02e6335fc4;p=thirdparty%2Fbinutils-gdb.git RISC-V: Fix missing instruction classes in error messages 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 --- 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_*"));