diff --git a/lld/MachO/ICF.cpp b/lld/MachO/ICF.cpp --- a/lld/MachO/ICF.cpp +++ b/lld/MachO/ICF.cpp @@ -275,7 +275,7 @@ // Into each origin-section hash, combine all reloc referent section hashes. for (icfPass = 0; icfPass < 2; ++icfPass) { parallelForEach(icfInputs, [&](ConcatInputSection *isec) { - uint64_t hash = isec->icfEqClass[icfPass % 2]; + uint32_t hash = isec->icfEqClass[icfPass % 2]; for (const Reloc &r : isec->relocs) { if (auto *sym = r.referent.dyn_cast()) { if (auto *defined = dyn_cast(sym)) { @@ -295,7 +295,7 @@ } } // Set MSB to 1 to avoid collisions with non-hashed classes. - isec->icfEqClass[(icfPass + 1) % 2] = hash | (1ull << 63); + isec->icfEqClass[(icfPass + 1) % 2] = hash | (1ull << 31); }); } @@ -391,7 +391,7 @@ assert(isec->icfEqClass[0] == 0); // don't overwrite a unique ID! // Turn-on the top bit to guarantee that valid hashes have no collisions // with the small-integer unique IDs for ICF-ineligible sections - isec->icfEqClass[0] = xxHash64(isec->data) | (1ull << 63); + isec->icfEqClass[0] = xxHash64(isec->data) | (1ull << 31); }); // Now that every input section is either hashed or marked as unique, run the // segregation algorithm to detect foldable subsections. diff --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h --- a/lld/MachO/InputSection.h +++ b/lld/MachO/InputSection.h @@ -117,7 +117,7 @@ // Points to the surviving section after this one is folded by ICF ConcatInputSection *replacement = nullptr; // Equivalence-class ID for ICF - uint64_t icfEqClass[2] = {0, 0}; + uint32_t icfEqClass[2] = {0, 0}; // With subsections_via_symbols, most symbols have their own InputSection, // and for weak symbols (e.g. from inline functions), only the diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp --- a/lld/MachO/InputSection.cpp +++ b/lld/MachO/InputSection.cpp @@ -30,7 +30,7 @@ // can differ based on STL debug levels (e.g. iterator debugging on MSVC's STL), // so account for that. static_assert(sizeof(void *) != 8 || - sizeof(ConcatInputSection) == sizeof(std::vector) + 96, + sizeof(ConcatInputSection) == sizeof(std::vector) + 88, "Try to minimize ConcatInputSection's size, we create many " "instances of it");