[lld] r230086 - PECOFF: Temporarily add a lock to un-break buildbot.

Rui Ueyama ruiu at google.com
Fri Feb 20 15:22:36 PST 2015


Author: ruiu
Date: Fri Feb 20 17:22:36 2015
New Revision: 230086

URL: http://llvm.org/viewvc/llvm-project?rev=230086&view=rev
Log:
PECOFF: Temporarily add a lock to un-break buildbot.

Looks like there's a threading issue in the COFF reader which makes
buildbot unstable. Probability of crash varies depending on the number
of input. If we are linking a big executalbe, LLD almost always crash.

This patch temporarily adds a lock to guard the reader so that LLD
doesn't crash. I'll investigate and fix the issue as soon as possible
because this patch has negative performance impact.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=230086&r1=230085&r2=230086&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Feb 20 17:22:36 2015
@@ -307,6 +307,10 @@ StringRef getMachineName(llvm::COFF::Mac
 }
 
 std::error_code FileCOFF::doParse() {
+  // Acquire a recursive lock because COFF file parsing has side effects.
+  // TODO: remove this lock as soon as possible after fixing threading issue.
+  std::lock_guard<std::recursive_mutex> lock(_ctx.getMutex());
+
   auto binaryOrErr = llvm::object::createBinary(_mb->getMemBufferRef());
   if (std::error_code ec = binaryOrErr.getError())
     return ec;





More information about the llvm-commits mailing list