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

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 09:50:27 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:
> ayermolo wrote:
> > 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
> Ok, thanks for the pointer. Then it does look like the intention was to make it thread safe. @MaskRay forget about downstream usage, do we want this function to be thread safe or not? 
@MaskRay can you comment on @wenlei question?


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