Skip to content

Commit cde806b

Browse files
committed
[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.
1 parent b6d1df2 commit cde806b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lld/MachO/SyntheticSections.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ void ObjCMethListSection::writeRelativeOffsetForIsec(
21192119
assert(selRef && "Expected all selector names to already be already be "
21202120
"present in __objc_selrefs");
21212121
symVA = selRef->getVA();
2122-
assert(selRef->data.size() == sizeof(target->wordSize) &&
2122+
assert(selRef->data.size() == target->wordSize &&
21232123
"Expected one selref per ConcatInputSection");
21242124
} else if (reloc->referent.is<Symbol *>()) {
21252125
auto *def = dyn_cast_or_null<Defined>(reloc->referent.get<Symbol *>());

0 commit comments

Comments
 (0)