[lld-macho] Increase slop to prevent thunk out of range again.
authorMike Hommey <mh@glandium.org>
Thu, 17 Nov 2022 02:31:28 +0000 (21:31 -0500)
committerJez Ng <jezng@fb.com>
Thu, 17 Nov 2022 03:11:54 +0000 (22:11 -0500)
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.

Reviewed By: #lld-macho, int3

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

lld/MachO/ConcatOutputSection.cpp

index e97f1e9..cbd3a24 100644 (file)
@@ -246,7 +246,7 @@ void TextOutputSection::finalize() {
     // 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++]);