[llvm] [AVR] Fix parsing & emitting relative jumps (PR #102936)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 04:57:34 PDT 2024
aykevl wrote:
> linker relaxation seems like a good argument (couldn't llvm just do it on its own, though?)
Just to clarify: the whole point of linker relaxation is that it can only be done at link time. A typical example would be to convert a `call` instruction (4 bytes) into a `rcall` instruction (2 bytes) if the call target is close enough (within 4kB of code). This will change every branch in that function that crosses the call instruction, so they will need to be updated. Hence why every branch needs a relocation when using linker relaxation. (I'm pretty sure it also breaks DWARF debugging on AVR, so it's not without cost, see [this post](https://maskray.me/blog/2021-03-14-the-dark-side-of-riscv-linker-relaxation)).
...but as long as we don't enable linker relaxation, there's nothing to worry about here. IIRC (but I'm not sure) there's a flag in the object file that tells the linker whether linker relaxation is supported, and I assume we don't set that flag.
https://github.com/llvm/llvm-project/pull/102936
More information about the llvm-commits
mailing list