[lld-macho] Use uint64_t instead of size_t to fix 32 bit test failures
authorDavid Spickett <david.spickett@linaro.org>
Thu, 16 Feb 2023 09:41:50 +0000 (09:41 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Thu, 16 Feb 2023 09:44:38 +0000 (09:44 +0000)
Our bot has been failing https://lab.llvm.org/buildbot/#/builders/178/builds/3967:
Assertion `isecEnd - isecVA <= forwardBranchRange && "should only finalize sections in jump range"' failed.

I think this is due to the use of size_t, which is 32 bit on 32 bit,
for a value used in some 64 bit address calculations. Which was added in
https://reviews.llvm.org/D144029.

Switching to uint64_t fixes the issues.

lld/MachO/ConcatOutputSection.cpp

index b522bd9..d4f60b6 100644 (file)
@@ -248,7 +248,7 @@ void TextOutputSection::finalize() {
     // grows. So leave room for a bunch of thunks.
     unsigned slop = 256 * thunkSize;
     while (finalIdx < endIdx) {
-      size_t expectedNewSize = alignTo(addr + size, inputs[finalIdx]->align) +
+      uint64_t expectedNewSize = alignTo(addr + size, inputs[finalIdx]->align) +
                                inputs[finalIdx]->getSize();
       if (expectedNewSize >= isecVA + forwardBranchRange - slop)
         break;