[lld] r248106 - COFF: Fix race condition.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 19 18:44:44 PDT 2015


Author: ruiu
Date: Sat Sep 19 20:44:44 2015
New Revision: 248106

URL: http://llvm.org/viewvc/llvm-project?rev=248106&view=rev
Log:
COFF: Fix race condition.

NextID is updated inside parallel_for_each, so it needs mutual exclusion.

Modified:
    lld/trunk/COFF/ICF.cpp

Modified: lld/trunk/COFF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ICF.cpp?rev=248106&r1=248105&r2=248106&view=diff
==============================================================================
--- lld/trunk/COFF/ICF.cpp (original)
+++ lld/trunk/COFF/ICF.cpp Sat Sep 19 20:44:44 2015
@@ -73,7 +73,7 @@ private:
   bool forEachGroup(std::vector<SectionChunk *> &Chunks, Comparator Eq);
   bool partition(ChunkIterator Begin, ChunkIterator End, Comparator Eq);
 
-  uint64_t NextID = 1;
+  std::atomic<uint64_t> NextID = { 1 };
 };
 
 // Entry point to ICF.




More information about the llvm-commits mailing list