]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
RISC-V: Don't show support for 1.9.1 priv spec
authorMarek Pikuła <m.pikula@partner.samsung.com>
Thu, 27 Mar 2025 14:09:15 +0000 (15:09 +0100)
committerNelson Chu <nelson@rivosinc.com>
Fri, 28 Mar 2025 01:20:50 +0000 (09:20 +0800)
The privileged spec 1.9.1 support was removed since binutils 2.43. The
linker only recognizes it and then reports a warning that it may
conflict with other spec versions.

While the support is removed, binutils should still recognize it, but it
shouldn't be exposed to the user in `disassember-options` help.

Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
opcodes/riscv-dis.c

index c341a0fe3174fe3eaac840dea4a87c422e71186e..f862ef28a161accf9b0429e6a044f31ff85b2874 100644 (file)
@@ -37,6 +37,9 @@
    disassemble_info::fprintf_func which is for unstyled output.  */
 #define fprintf_func please_use_fprintf_styled_func_instead
 
+/* The earliest privilege spec supported by disassembler. */
+#define PRIV_SPEC_EARLIEST PRIV_SPEC_CLASS_1P10
+
 struct riscv_private_data
 {
   bfd_vma gp;
@@ -139,7 +142,7 @@ parse_riscv_dis_option (const char *option, struct disassemble_info *info)
       const char *name = NULL;
 
       RISCV_GET_PRIV_SPEC_CLASS (value, priv_spec);
-      if (priv_spec == PRIV_SPEC_CLASS_NONE)
+      if (priv_spec < PRIV_SPEC_EARLIEST)
        opcodes_error_handler (_("unknown privileged spec set by %s=%s"),
                               option, value);
       else if (pd->default_priv_spec == PRIV_SPEC_CLASS_NONE)
@@ -1608,12 +1611,12 @@ disassembler_options_riscv (void)
       args = XNEWVEC (disasm_option_arg_t, num_args + 1);
 
       args[RISCV_OPTION_ARG_PRIV_SPEC].name = "SPEC";
-      priv_spec_count = PRIV_SPEC_CLASS_DRAFT - PRIV_SPEC_CLASS_NONE - 1;
+      priv_spec_count = PRIV_SPEC_CLASS_DRAFT - PRIV_SPEC_EARLIEST;
       args[RISCV_OPTION_ARG_PRIV_SPEC].values
         = XNEWVEC (const char *, priv_spec_count + 1);
       for (i = 0; i < priv_spec_count; i++)
        args[RISCV_OPTION_ARG_PRIV_SPEC].values[i]
-          = riscv_priv_specs[i].name;
+         = riscv_priv_specs[PRIV_SPEC_EARLIEST - PRIV_SPEC_CLASS_NONE - 1 + i].name;
       /* The array we return must be NULL terminated.  */
       args[RISCV_OPTION_ARG_PRIV_SPEC].values[i] = NULL;