[PATCH] D113809: [MachO] Fix struct size assertion

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 12 15:13:20 PST 2021


smeenai created this revision.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
smeenai requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113809

Files:
  lld/MachO/InputSection.h


Index: lld/MachO/InputSection.h
===================================================================
--- lld/MachO/InputSection.h
+++ lld/MachO/InputSection.h
@@ -150,7 +150,7 @@
 };
 
 // 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");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113809.386963.patch
Type: text/x-patch
Size: 495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211112/32aa366a/attachment-0001.bin>


More information about the llvm-commits mailing list