]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - opcodes/riscv-dis.c
Re-work RISC-V gas flags: now we just support -mabi and -march
[thirdparty/binutils-gdb.git] / opcodes / riscv-dis.c
index 3b4e1e01ef455248d86c23f119359222c5154a32..cb263505d169390fb8deecb55258be5d6679790f 100644 (file)
@@ -406,8 +406,12 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info)
     {
       int xlen = 0;
 
-      /* The incoming section might not always be complete.  */
-      if (info->section != NULL)
+      /* If XLEN is not known, get its value from the ELF class.  */
+      if (info->mach == bfd_mach_riscv64)
+       xlen = 64;
+      else if (info->mach == bfd_mach_riscv32)
+       xlen = 32;
+      else if (info->section != NULL)
        {
          Elf_Internal_Ehdr *ehdr = elf_elfheader (info->section->owner);
          xlen = ehdr->e_ident[EI_CLASS] == ELFCLASS64 ? 64 : 32;