[PATCH] D116705: [lld-macho] Increase slops to prevent thunk out of range

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 15:08:33 PST 2022


thevinster created this revision.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
thevinster edited the summary of this revision.
Herald added a subscriber: kristof.beyls.
thevinster published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

One of our internal arm64 apps hit a thunk out of range error when building
with LLD. Per the comment, increasing slop size by 2x fixed the issue. The
multiplier is chosen arbitrarily, and could be increased further if needed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116705

Files:
  lld/MachO/ConcatOutputSection.cpp


Index: lld/MachO/ConcatOutputSection.cpp
===================================================================
--- lld/MachO/ConcatOutputSection.cpp
+++ lld/MachO/ConcatOutputSection.cpp
@@ -244,7 +244,7 @@
     // contains several branch instructions in succession, then the distance
     // from the current position to the position where the thunks are inserted
     // grows. So leave room for a bunch of thunks.
-    unsigned slop = 100 * thunkSize;
+    unsigned slop = 200 * thunkSize;
     while (finalIdx < endIdx && isecAddr + inputs[finalIdx]->getSize() <
                                     isecVA + forwardBranchRange - slop)
       finalizeOne(inputs[finalIdx++]);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116705.397724.patch
Type: text/x-patch
Size: 678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220105/55bedac6/attachment.bin>


More information about the llvm-commits mailing list