[PATCH] D120073: [LLD] Fix for race condition.

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 14:21:11 PDT 2022


wenlei added inline comments.


================
Comment at: lld/ELF/InputSection.cpp:122-123
   {
-    static std::mutex mu;
     std::lock_guard<std::mutex> lock(mu);
     uncompressedBuf = bAlloc().Allocate<char>(size);
----------------
IIUC, uncompress is currently in an inconsistent state between having thread safety and not. If we don't actually intend to make uncompress thread safe, perhaps this mutex can also be removed? 

Agree that downstream usage doesn't necessarily justify making the upstream implementation thread safe. Though it would be good to make it clear whether uncompress is supposed to be thread safe or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120073



More information about the llvm-commits mailing list