[PATCH] D108897: [lld/mac] Set branchRange a bit more carefully
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 29 15:58:17 PDT 2021
thakis added inline comments.
================
Comment at: lld/MachO/ConcatOutputSection.cpp:258
uint64_t lowVA = branchRange < callVA ? callVA - branchRange : 0;
- uint64_t highVA = callVA + branchRange;
+ uint64_t highVA = callVA + branchRange - 4;
// Calculate our call referent address
----------------
tschuett wrote:
> thakis wrote:
> > (See also `AArch64::inBranchRange` in lld/ELF/Arch/AArch64.cpp)
> Do you have something with more information than a 4. Maybe sizeof() or a named constant?
It's really just `1 * 4` in simplified. The range of a two's complement number is -2^n..(2^n - 1), and the call offset is multiplied by 4 to get more range (since function start addresses are required to be 4-aligned on arm64).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108897/new/
https://reviews.llvm.org/D108897
More information about the llvm-commits
mailing list