Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
Respect objdump -m flag
Browse files Browse the repository at this point in the history
This resolves at least part of #19; it might also fix gdb disassembly.
  • Loading branch information
aswaterman committed Nov 13, 2016
1 parent 73354bd commit 9a8cb24
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions opcodes/riscv-dis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9a8cb24

Please sign in to comment.