[lld] cde806b - [lld][MachO] Fix a suspicous assert in SyntheticSections.cpp
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 03:13:08 PDT 2024
Author: David Spickett
Date: 2024-08-19T10:12:45Z
New Revision: cde806b0e63fddcca013536b4bd55e45607205d1
URL: https://github.com/llvm/llvm-project/commit/cde806b0e63fddcca013536b4bd55e45607205d1
DIFF: https://github.com/llvm/llvm-project/commit/cde806b0e63fddcca013536b4bd55e45607205d1.diff
LOG: [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.
Added:
Modified:
lld/MachO/SyntheticSections.cpp
Removed:
################################################################################
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<Symbol *>()) {
auto *def = dyn_cast_or_null<Defined>(reloc->referent.get<Symbol *>());
More information about the llvm-commits
mailing list