From 0e1fb48bb95abaf94c0d21b58c4c075f6faad8ba Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 16 Feb 2023 09:41:50 +0000 Subject: [PATCH] [lld-macho] Use uint64_t instead of size_t to fix 32 bit test failures 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lld/MachO/ConcatOutputSection.cpp b/lld/MachO/ConcatOutputSection.cpp index b522bd9..d4f60b6d 100644 --- a/lld/MachO/ConcatOutputSection.cpp +++ b/lld/MachO/ConcatOutputSection.cpp @@ -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; -- 2.7.4