[lld] 637a339 - [MachO] Fix struct size assertion

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 16:31:04 PST 2021


Author: Shoaib Meenai
Date: 2021-11-16T16:30:31-08:00
New Revision: 637a3396b3f8292d2118973b90eff314c553f6d2

URL: https://github.com/llvm/llvm-project/commit/637a3396b3f8292d2118973b90eff314c553f6d2
DIFF: https://github.com/llvm/llvm-project/commit/637a3396b3f8292d2118973b90eff314c553f6d2.diff

LOG: [MachO] Fix struct size assertion

It was checking for 64-bit builds incorrectly. Unfortunately,
ConcatInputSection has grown a bit in the meantime, and I don't see any
obvious way to shrink it. Perhaps icfEqClass could use 32-bit hashes
instead of 64-bit ones, but xxHash64 is supposed to be much faster than
xxHash32 (https://github.com/Cyan4973/xxHash#benchmarks), so that sounds
like a loss. (Unrelatedly, we should really look at using XXH3 instead
of xxHash64 now.)

Reviewed By: #lld-macho, int3

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

Added: 
    

Modified: 
    lld/MachO/InputSection.h

Removed: 
    


################################################################################
diff  --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h
index 621cea5073b9..d0c0b45c1b66 100644
--- a/lld/MachO/InputSection.h
+++ b/lld/MachO/InputSection.h
@@ -150,7 +150,7 @@ class ConcatInputSection final : public InputSection {
 };
 
 // Verify ConcatInputSection's size on 64-bit builds.
-static_assert(sizeof(int) != 8 || sizeof(ConcatInputSection) == 112,
+static_assert(sizeof(void *) != 8 || sizeof(ConcatInputSection) == 120,
               "Try to minimize ConcatInputSection's size, we create many "
               "instances of it");
 


        


More information about the llvm-commits mailing list