Revert "[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash"

This reverts commit 112135e774.
Breaks lld/test/MachO/{icf.s,cfstring-dedup.s,invalid/cfstring.s}
This commit is contained in:
Nico Weber 2022-03-07 13:50:38 -05:00
parent 4133a85c86
commit d86d431814
1 changed files with 4 additions and 3 deletions

View File

@ -278,7 +278,9 @@ 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 *defined = dyn_cast<Defined>(sym)) {
if (auto *dylibSym = dyn_cast<DylibSymbol>(sym))
hash += dylibSym->stubsHelperIndex;
else if (auto *defined = dyn_cast<Defined>(sym)) {
if (defined->isec) {
if (auto referentIsec =
dyn_cast<ConcatInputSection>(defined->isec))
@ -289,9 +291,8 @@ void ICF::run() {
} else {
hash += defined->value;
}
} else if (!isa<Undefined>(sym)) { // ICF runs before Undefined diags
} else if (!isa<Undefined>(sym)) // ICF runs before Undefined diags.
llvm_unreachable("foldIdenticalSections symbol kind");
}
}
}
// Set MSB to 1 to avoid collisions with non-hashed classes.