[PATCH] D56955: COFF, ELF: Adjust ICF hash computation to account for self relocations.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 22 15:52:44 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL351898: COFF, ELF: Adjust ICF hash computation to account for self relocations. (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56955?vs=182988&id=182992#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56955/new/

https://reviews.llvm.org/D56955

Files:
  lld/trunk/COFF/ICF.cpp
  lld/trunk/ELF/ICF.cpp


Index: lld/trunk/COFF/ICF.cpp
===================================================================
--- lld/trunk/COFF/ICF.cpp
+++ lld/trunk/COFF/ICF.cpp
@@ -271,7 +271,7 @@
     uint32_t Hash = SC->Class[1];
     for (Symbol *B : SC->symbols())
       if (auto *Sym = dyn_cast_or_null<DefinedRegular>(B))
-        Hash ^= Sym->getChunk()->Class[1];
+        Hash += Sym->getChunk()->Class[1];
     // Set MSB to 1 to avoid collisions with non-hash classs.
     SC->Class[0] = Hash | (1U << 31);
   });
Index: lld/trunk/ELF/ICF.cpp
===================================================================
--- lld/trunk/ELF/ICF.cpp
+++ lld/trunk/ELF/ICF.cpp
@@ -431,7 +431,7 @@
     Symbol &S = IS->template getFile<ELFT>()->getRelocTargetSym(Rel);
     if (auto *D = dyn_cast<Defined>(&S))
       if (auto *RelSec = dyn_cast_or_null<InputSection>(D->Section))
-        Hash ^= RelSec->Class[1];
+        Hash += RelSec->Class[1];
   }
   // Set MSB to 1 to avoid collisions with non-hash IDs.
   IS->Class[0] = Hash | (1U << 31);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56955.182992.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190122/421de8de/attachment-0001.bin>


More information about the llvm-commits mailing list