[PATCH] D31184: [ELF] - Prepare GnuHashTableSection<ELFT> for detemplation.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 14:32:49 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1493-1494
     size_t I = (Sym.Hash / C) & (MaskWords - 1);
-    Filter[I] |= uintX_t(1) << (Sym.Hash % C);
-    Filter[I] |= uintX_t(1) << ((Sym.Hash >> getShift2()) % C);
+    uint64_t Val = (Config->Wordsize == 8) ? read64(&((uint64_t *)Buf)[I], E)
+                                           : read32(&((uint32_t *)Buf)[I], E);
+    Val |= uint64_t(1) << (Sym.Hash % C);
----------------
Just like `writeUint`, you want to define `readUint`.


================
Comment at: ELF/SyntheticSections.cpp:1514
     if (!Syms[I].empty())
-      Buckets[I] = Syms[I][0].Body->DynsymIndex;
+      write32(&Buckets[I], Syms[I][0].Body->DynsymIndex, E);
 
----------------
`&Buckets[I]` -> Buckets + I


================
Comment at: ELF/SyntheticSections.cpp:1525-1526
     for (const Entry &Ent : makeArrayRef(Vec).drop_back())
-      Values[I++] = Ent.Hash & ~1;
-    Values[I++] = Vec.back().Hash | 1;
+      write32(&Values[I++], Ent.Hash & ~1, E);
+    write32(&Values[I++], Vec.back().Hash | 1, E);
   }
----------------
`&Values[I++]` -> `Values + I++`


https://reviews.llvm.org/D31184





More information about the llvm-commits mailing list