From cde806b0e63fddcca013536b4bd55e45607205d1 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 19 Aug 2024 10:04:29 +0000 Subject: [PATCH] [lld][MachO] Fix a suspicous assert in SyntheticSections.cpp This was comparing some .size() (uint64_t) against the sizeof a size_t which changes with system bitness. This produced a warning that brought this to my attention. These tests were failing too on 32 bit Arm only: lld :: MachO/objc-category-merging-complete-test.s lld :: MachO/objc-category-merging-minimal.s The assert I think meant to check the value of target->wordSize, not the size of its type. Which is a type that changes size between systems. --- lld/MachO/SyntheticSections.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index 6b4ec4989ca4a1..939e9b286d77f5 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -2119,7 +2119,7 @@ void ObjCMethListSection::writeRelativeOffsetForIsec( assert(selRef && "Expected all selector names to already be already be " "present in __objc_selrefs"); symVA = selRef->getVA(); - assert(selRef->data.size() == sizeof(target->wordSize) && + assert(selRef->data.size() == target->wordSize && "Expected one selref per ConcatInputSection"); } else if (reloc->referent.is()) { auto *def = dyn_cast_or_null(reloc->referent.get());