Improve RISC-V .option arch validation for unimplemented extensions
Ensures that the assembler correctly rejects unsupported RISC-V architecture extensions specified via `.option arch`.
The RISC-V assembler incorrectly accepted some unimplemented architecture extensions when specified using the .option arch directive. This commit corrects the validation logic in riscv_update_subset1 to ensure that any unimplemented extensions result in an error, consistent with the handling of full, unimplemented specifications. It also renames and clarifies the purpose of the explicit_subset parameter.
In Details
This commit addresses a validation flaw in the RISC-V assembler's handling of the .option arch directive. Previously, while full unimplemented specifications like rv32ip were rejected, individual unimplemented extensions like +p were accepted. The function riscv_update_subset1 was incorrectly passing true to riscv_parse_add_subset for such cases. The fix involves correcting this logic, refactoring riscv_update_subset1 to take a boolean for implicit_exts and adjusting its parameter explicit_subset to be a true boolean, ensuring stricter adherence to supported extensions.
- RISC-V
- An open-standard instruction set architecture (ISA) based on reduced instruction set computer (RISC) principles.
- .option arch
- An assembler directive used in RISC-V assembly code to specify the target architecture and extensions.
- architecture extensions
- Optional sets of instructions or features that can be added to a base RISC-V ISA to support specific functionalities (e.g., 'P' for packed SIMD instructions).
- assembler
- A program that translates assembly language code into machine code.