[binutils-gdb] RISC-V: Don't show support for 1.9.1 priv spec

Nelson Chu nelsonc1225@sourceware.org
Fri Mar 28 01:28:27 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d1f4362682f0c3be74f8d8d8e097e9c4a4d04f2

commit 0d1f4362682f0c3be74f8d8d8e097e9c4a4d04f2
Author: Marek Pikuła <m.pikula@partner.samsung.com>
Date:   Thu Mar 27 15:09:15 2025 +0100

    RISC-V: Don't show support for 1.9.1 priv spec
    
    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>

Diff:
---
 opcodes/riscv-dis.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index c341a0fe317..f862ef28a16 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -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;


More information about the Binutils-cvs mailing list