Skip to content
This repository has been archived by the owner on Sep 2, 2018. It is now read-only.

Non PC-relative branch targets are incorrect #83

Open
dylanmckay opened this issue May 4, 2015 · 0 comments
Open

Non PC-relative branch targets are incorrect #83

dylanmckay opened this issue May 4, 2015 · 0 comments

Comments

@dylanmckay
Copy link
Member

RJMP .+12 is properly encoded.
RJMP 12 is not.

In fact they are treated and encoded the same.

All relative jump targets act as if there is an implicit .[+][-] in front of them.

rjmp 12 is currently the same as rjmp .+2.

GCC does not do this. It treats 12 as an absolute address, and then subtracts it from the program counter to create a relative address, and this will then be the operand to the relative branch.

I don't think this is particularly high priority, as it is very uncommon (and bad practice) to use magic numbers in branch instructions (labels should be used instead). However, this is still not the correct output so it's still very important.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant