[all-commits] [llvm/llvm-project] 972119: [lld/mac] Set branchRange a bit more carefully

Nico Weber via All-commits all-commits at lists.llvm.org
Mon Aug 30 09:36:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9721197520e5badd4e6385399f6b08575c6c8504
      https://github.com/llvm/llvm-project/commit/9721197520e5badd4e6385399f6b08575c6c8504
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-08-30 (Mon, 30 Aug 2021)

  Changed paths:
    M lld/MachO/Arch/ARM64.cpp
    M lld/MachO/ConcatOutputSection.cpp
    M lld/MachO/Target.h

  Log Message:
  -----------
  [lld/mac] Set branchRange a bit more carefully

- Don't subtract thunkSize from branchRange. Most places care about
  the actual maximal branch range. Subtract thunkSize in the one place
  that wants to leave room for a thunk.
- Set it to 0x800_0000 instead of 0xFF_FFFF
- Subtract 4 for the positive branch direction since it's a
  two's complement 24bit number sign-extended mutiplied by 4,
  so its range is -0x800_0000..+0x7FF_FFFC
- Make boundary checks include the boundary values

This doesn't make a huge difference in practice. It's preparation
for a "real" fix for PR51578 -- but it also lets the repro in comment 0
in that bug place one more thunk before hitting the TODO.

Differential Revision: https://reviews.llvm.org/D108897




More information about the All-commits mailing list