Skip to content

Commit

Permalink
[lld][MachO] Fix a suspicous assert in SyntheticSections.cpp
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DavidSpickett committed Aug 19, 2024
1 parent b6d1df2 commit cde806b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lld/MachO/SyntheticSections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 *>());
Expand Down

0 comments on commit cde806b

Please sign in to comment.