Skip to content

Commit

Permalink
Re-land [lld-macho][nfc] Don't use stubsHelperIndex in ICF hash
Browse files Browse the repository at this point in the history
Previous attempt was commit 112135e and
reverted in d86d431.
  • Loading branch information
int3 committed Mar 7, 2022
1 parent 7643633 commit 0405920
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lld/MachO/ICF.cpp
Expand Up @@ -278,9 +278,7 @@ void ICF::run() {
uint32_t hash = isec->icfEqClass[icfPass % 2];
for (const Reloc &r : isec->relocs) {
if (auto *sym = r.referent.dyn_cast<Symbol *>()) {
if (auto *dylibSym = dyn_cast<DylibSymbol>(sym))
hash += dylibSym->stubsHelperIndex;
else if (auto *defined = dyn_cast<Defined>(sym)) {
if (auto *defined = dyn_cast<Defined>(sym)) {
if (defined->isec) {
if (auto referentIsec =
dyn_cast<ConcatInputSection>(defined->isec))
Expand All @@ -291,8 +289,10 @@ void ICF::run() {
} else {
hash += defined->value;
}
} else if (!isa<Undefined>(sym)) // ICF runs before Undefined diags.
llvm_unreachable("foldIdenticalSections symbol kind");
} else {
// ICF runs before Undefined diags
assert(isa<Undefined>(sym) || isa<DylibSymbol>(sym));
}
}
}
// Set MSB to 1 to avoid collisions with non-hashed classes.
Expand Down

0 comments on commit 0405920

Please sign in to comment.