[PATCH] RISC-V: Let riscv_parse_subset set the default_arch for dis-assembler

Nelson Chu nelson@rivosinc.com
Thu Jul 31 02:33:22 GMT 2025


If we passing NULL string to riscv_parse_subset, then it will call
riscv_set_default_arch to set the default architecure from the
riscv_all_supported_ext table, to check if the extensions'
default_enable are true or not.
---
 opcodes/riscv-dis.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index f6af9c47a25..fe7943ec710 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -1444,7 +1444,7 @@ riscv_init_disasm_info (struct disassemble_info *info)
   pd->riscv_rps_dis.xlen = &pd->xlen;
   pd->riscv_rps_dis.isa_spec = &pd->default_isa_spec;
   pd->riscv_rps_dis.check_unknown_prefixed_ext = false;
-  pd->default_arch = "rv64gc";
+  pd->default_arch = NULL;
   if (info->section != NULL)
     {
       bfd *abfd = info->section->owner;
@@ -1479,6 +1479,7 @@ riscv_init_disasm_info (struct disassemble_info *info)
 
   info->private_data = pd;
   riscv_dis_parse_subset (info, pd->default_arch);
+  pd->default_arch = pd->riscv_rps_dis.subset_list->arch_str;
   return true;
 }
 
-- 
2.39.5 (Apple Git-154)



More information about the Binutils mailing list