[lld] 0e1fb48 - [lld-macho] Use uint64_t instead of size_t to fix 32 bit test failures
    David Spickett via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Feb 16 01:45:06 PST 2023
    
    
  
Author: David Spickett
Date: 2023-02-16T09:44:38Z
New Revision: 0e1fb48bb95abaf94c0d21b58c4c075f6faad8ba
URL: https://github.com/llvm/llvm-project/commit/0e1fb48bb95abaf94c0d21b58c4c075f6faad8ba
DIFF: https://github.com/llvm/llvm-project/commit/0e1fb48bb95abaf94c0d21b58c4c075f6faad8ba.diff
LOG: [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.
Added: 
    
Modified: 
    lld/MachO/ConcatOutputSection.cpp
Removed: 
    
################################################################################
diff  --git a/lld/MachO/ConcatOutputSection.cpp b/lld/MachO/ConcatOutputSection.cpp
index b522bd9b289ee..d4f60b6dd7188 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;
        
    
    
More information about the llvm-commits
mailing list