RISC-V: Set insn info fields correctly when disassembling. #2
Open
RISC-V: Set insn info fields correctly when disassembling. #2
Conversation
This fixes a problem reported via github
riscvarchive/riscv-binutils-gdb#153
We are setting insn_info_valid, but not setting insn_type and data_size. This
patch adds support to set the two fields.
This was tested by adding some code to print the two fields, disassembling
libstdc++, and then checking to make sure the output was right. It was also
testing with cross riscv{32,64}-{elf,linux} builds and make checks, and there
were no regressions.
Committed.
Jim
The original patch is from
https://sourceware.org/ml/binutils/2018-07/msg00508.html and is ported
to PULP binutils (which is about version 1.28) by me. Use git diff
--word-diff for a better overview of the changes.
Robert
include/
* opcode/riscv.h (INSN_TYPE, INSN_BRANCH, INSN_CONDBRANCH, INSN_JSR)
(INSN_DREF, INSN_DATA_SIZE, INSN_DATA_SIZE_SHIFT, INSN_1_BYTE)
(INSN_2_BYTE, INSN_4_BYTE, INSN_8_BYTE, INSN_16_BYTE): New.
opcodes/
* riscv-dis.c (riscv_disassemble_insn): Set insn_type and data_size
fields.
* riscv-opc.c (riscv_opcodes): Use new INSN_* flags to annotate insns.
gtagliavini
added a commit
that referenced
this pull request
Apr 14, 2020
extend binutils to support SPR 2 and 3 (mac&load)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ported this patch from binutils 1.30. The disassembler struct (
disassembler_info) has a member struct (insn_type) that should be filled out with the appropriate information for the currently disassembled instruction. This was handled not at all before, despite signaling that information was filled in.This patch is basically only relevant if one uses the opcodes library.