[llvm] [AVR] Emit relocation record for local branch (PR #145291)

Patryk Wychowaniec via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 04:35:46 PDT 2025


Patryk27 wrote:

Yes, that's alright - `-2` stems from the fact that relocatable jumps are emitted with offset of zero (after all, linker will overwrite the instruction anyway) _and_ because jumps are relative to the beginning of the current instruction:

https://github.com/llvm/llvm-project/blob/1dc46d45fcf7869f7e8edc5315aec6158f77966e/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp#L63

(iirc there's a minor impedance mismatch between how LLVM and AVR understand jumps, hence we need to do this correction before emitting the code)

One way or another, -2 is alright!

https://github.com/llvm/llvm-project/pull/145291


More information about the llvm-commits mailing list