<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102436>102436</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AVR] Jumps are offset by 2
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Patryk27
</td>
</tr>
</table>
<pre>
Hi,
Ever since https://github.com/llvm/llvm-project/commit/6859685a87ad093d60c8bed60b116143c0a684c7 (or, more precisely, https://github.com/llvm/llvm-project/commit/84428dafc0941e3a31303fa1b286835ab2b8e234), the AVR backend encodes jumps across basic blocks with an extra offset of 2.
That's related to this check:
https://github.com/llvm/llvm-project/blob/1919db907bc3e0541839992d903b6b875da98b04/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp#L521
... which wasn't triggered for basic blocks before, but it is now (i.e. `shouldForceRelocation()` returns `true` for such jumps now).
I'm working on a pure LLVM reproducer, but the original rustc issue has been reported [here](https://github.com/Rahix/avr-hal/issues/571) - if you compare the *.elf from older toolchain and the newer toolchain, you'll see that calls are alright, but jumps have an extra offset.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE9v47gP_TTKhagh0_8PPqTtL_jtogMsikHvlETHmspWIMnN5NsvlEx3M3tYYBYGbIOQHsn3Hkkx2uPKPIrmUTTPO9rS7MP4B6Vwecdup7y5jP-3Ap-EfBZyf3v_74MDRLtqhjmlUxTVXuBB4OFo07ypQvtF4MG5j8_Pwyn4b6yTwIP2y2LzT9s3Q9s31Hdk5FCZVupesWmlKsu2rCstqe1r3YHA3geBT7D4wHAKrG1kd8mR_569r2vsDU1aDnXJFVVlJauJSoV921cNKVQ9Y1ULHHKiNDPs315BkX7n1QCv2huO8G1bThFIBx8jKIpWg3Jev0c42zQDrcDfUyDw0xQ5gZ8Ai3smv86UBHYRAjtKbCB5SLONoGfW77mzu8O_3K1yXgk8lEM5GDXITumKZVOXfTUMA5pBVqpVfdcYGnol6zscm-99pXDkjLN_exV4-PJ0Czxz1LfgPi6PN0IKfToJrF4aLO8rLooCzrPVM5wprgK7BCnY45EDG5h8-JkyxZMPnOlWWwKbwEZY_TkbwBZcgGhlnP3mzMEHza_svKZk_SqwzzK1EgKnLawxn0xh4xzKWeKm5x9Srf4scPhJg98EdgucfXi36xH8CgSnLTC8vLx9gcCn4M2mOXzWla3ggz3alRyELSYNNsaNYabcAq_5jg9ZTNE8zhxYNM8C-39R75Vm-13ggT7Cw0xO4OGKGAUemq4UOMAD2AkufgPtlxMFvlYhcF-wm2AKfgHvDAdI3js9k12BVnM9tPL5Pp67uPhNYOccRM5AlECTcxEyLrlgj3P6bPZG2kwf_E8vFzszVmaoBtrxWHZYlbLtO7mbR9MqVhK71nCrp6HVHapOGW5qPcimrHd2RIm17PNTd40saGi7dsKJdFtWsiRRS17IuiLbsfDhuLvyMZYS66rdOVLs4nVlIa58vvEvEPMGC-N1CNR2jKKWzsYU_4ZJNrnrrsuObp7h99v4Bv4cUHUB3G3Bjb88a38p9qPIjxH_DAAA__-OVLQQ">