[PATCH] D133003: [WIP][ELF] Parallelize relocation scanning

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 11:45:40 PDT 2022


ikudrin added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:299-300
                                uint64_t size) {
-  Symbol old = sym;
-
+  Symbol old{Symbol::PlaceholderKind, nullptr, StringRef(), 0, 0, 0};
+  memcpy(&old, &sym, sizeof(old));
   sym.replace(Defined{sym.file, StringRef(), sym.binding, sym.stOther,
----------------
Why not define a copy constructor?


================
Comment at: lld/ELF/Symbols.h:289
 
-  // True if this symbol needs a canonical PLT entry, or (during
-  // postScanRelocations) a copy relocation.
-  uint8_t needsCopy : 1;
+  uint8_t needsTlsGdToIe : 1;
 
----------------
Why is not `needsTlsGdToIe` moved under `atomic` like `needsTlsGd` and alike?


================
Comment at: lld/ELF/Symbols.h:306
 
+  void setFlag(uint8_t bit) { flags.fetch_or(bit, std::memory_order_relaxed); }
+  bool hasFlag(uint8_t bit) const {
----------------
You use it with two flags at least once, maybe call it `setFlags`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133003



More information about the llvm-commits mailing list