llvm
llvm copied to clipboard
Non PC-relative branch targets are incorrect
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.