Hello, I'm finding with GAS for the m68k target that the following
snippets of code fail to assemble:

> repro:
>       jmp     %pc@(label_a-4, %d0:w)
>       rts
> label_a:
>       lea     %pc@(label_b-4, %d0:w), %a0
>       rts
> label_b:

With the error:

> repro.s: Assembler messages:
> repro.s:2: Error: invalid byte branch offset
> repro.s:5: Error: invalid byte branch offset

This comes from gas/config/tc-m68k.c line 4887 in which a fixup is
applied by md_apply_fix() for PC-relative displacements.  I believe this
fix should only be applied if the 0-displaced PC-relative offset is not
the result of an effective address rather only the offset format used by
branches.  I have not yet found a way to mitigate this myself as I can't
find a way back from the data available in md_apply_fix to the opcode
information that would distinguish a branch from an effective address
PC-relative displacement.  I believe this sort of check would alleviate
the issue and if I find a way to check myself I'll share a patch.

This is with GNU binutils 2.47 compiled for a m68k-unknown-elf target.

- Matt G.

Reply via email to