[PATCH] D108930: [lld/mac] Leave more room for thunks in thunk placement code
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 30 19:08:33 PDT 2021
thakis added a comment.
I thought it'd be awkward to test, but it actually wasn't. Added a test.
Thanks for the review!
================
Comment at: lld/MachO/ConcatOutputSection.cpp:242
+ // Assign addresses up-to the forward branch-range limit.
+ // Every call instruction needs a small number of bytes (on Arm64: 4),
+ // and each inserted thunk needs a slighly larger number of bytes
----------------
int3 wrote:
> I'm confused about why the number of bytes for a call instruction is relevant here, since the call instruction will always be present regardless of whether the thunk is inserted
What matters is the distance to the instruction after the call instruction. If there are at least 12 bytes between call instructions, all's well. Since we're at a call instruction, there are guaranteed to be at least 4 bytes until the next call instruction. So we lose 8 bytes for every two directly consecutive calls.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108930/new/
https://reviews.llvm.org/D108930
More information about the llvm-commits
mailing list