foss-for-synopsys-dwc-arc-processors / binutils-gdb

A mirror of the upstream binutils-gdb repository for ARC specific work
GNU General Public License v2.0
13 stars 10 forks source link

Determine a branch target of DBNZ correctly (version 1) #76

Closed kolerov closed 9 months ago

kolerov commented 9 months ago

DBNZ instruction is in BRANCH class as other branch instructons like B, Bcc, etc. However, DBNZ is the only one branch instruction that stores a branch offset not in the first operand but in the second one.

However, current logic of arc_insn_get_branch_target assumes that a branch offset is always stored in the first operand for BRANCH class. Thus, it's necessary to add extra logic for determining DBNZ and getting a correct offset.

This PR resolves this issue: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/546

kolerov commented 9 months ago

I created 2 different PR from this:

  1. https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/pull/77
  2. https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/pull/78