[PATCH] D41884: Fix thread race between SectionPiece's OutputOff and Live members

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 00:04:50 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL322264: Fix thread race between SectionPiece's OutputOff and Live members (authored by dim, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41884?vs=129167&id=129400#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41884

Files:
  lld/trunk/ELF/SyntheticSections.cpp


Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -2451,10 +2451,8 @@
   parallelForEachN(0, Concurrency, [&](size_t ThreadId) {
     for (MergeInputSection *Sec : Sections) {
       for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) {
-        if (!Sec->Pieces[I].Live)
-          continue;
         size_t ShardId = getShardId(Sec->Pieces[I].Hash);
-        if ((ShardId & (Concurrency - 1)) == ThreadId)
+        if ((ShardId & (Concurrency - 1)) == ThreadId && Sec->Pieces[I].Live)
           Sec->Pieces[I].OutputOff = Shards[ShardId].add(Sec->getData(I));
       }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41884.129400.patch
Type: text/x-patch
Size: 727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180111/b0590341/attachment.bin>


More information about the llvm-commits mailing list