RISC-V: Correctly name MIPS vendor instruction extensions
Fixes incorrect error messages for MIPS vendor instructions in RISC-V assembly.
The RISC-V assembler now correctly identifies and reports errors for MIPS vendor instructions. Previously, it would output a generic ‘internal: unreachable INSN_CLASS_*’ message instead of naming the specific MIPS extension involved when the extension was not enabled. This commit adds the necessary cases to riscv_multi_subset_supports_ext and includes a new test case to verify the fix.
In Details
The riscv_multi_subset_supports_ext function in bfd/elfxx-riscv.c is responsible for mapping instruction classes to their corresponding RISC-V extension names. This commit adds support for four MIPS-related instruction classes (INSN_CLASS_XMIPS*) that were previously unhandled. By adding these cases, the assembler can now provide accurate diagnostic messages when MIPS vendor instructions are used without their respective extensions being enabled, improving usability for developers working with mixed-ISA code or specific vendor extensions.
- RISC-V
- An open-standard instruction set architecture (ISA) based on reduced instruction set computing principles.
- MIPS
- Microprocessor without Interlocked Pipeline Stages. A family of RISC instruction set architectures developed by MIPS Computer Systems (now MIPS Technologies).
- Assembler
- A program that translates assembly language code into machine code that the processor can execute.
- Instruction Class
- A categorization of machine instructions based on their functionality or the extensions they belong to, used internally by the assembler and compiler.