[PATCH] D138174: [lld-macho] Increase slop to prevent thunk out of range again.

Mike Hommey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 17:59:56 PST 2022


glandium created this revision.
Herald added a subscriber: kristof.beyls.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
glandium requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Building Firefox with -O0 on arm64 mac recently hit the
"FIXME: thunk range overrun" error on multiple occasions.

Doubling or tripling slop was not sufficient in some cases, so
quadruple it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138174

Files:
  lld/MachO/ConcatOutputSection.cpp


Index: lld/MachO/ConcatOutputSection.cpp
===================================================================
--- lld/MachO/ConcatOutputSection.cpp
+++ lld/MachO/ConcatOutputSection.cpp
@@ -246,7 +246,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 = 256 * thunkSize;
+    unsigned slop = 1024 * thunkSize;
     while (finalIdx < endIdx && addr + size + inputs[finalIdx]->getSize() <
                                     isecVA + forwardBranchRange - slop)
       finalizeOne(inputs[finalIdx++]);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138174.475976.patch
Type: text/x-patch
Size: 682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221117/2e320f1f/attachment.bin>


More information about the llvm-commits mailing list