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

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 15:30:48 PDT 2022


ayermolo 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);
----------------
wenlei wrote:
> 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.
Original diff that added the mutex: https://reviews.llvm.org/D59269


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