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.

llvm-svn: 230086
This commit is contained in:
Rui Ueyama 2015-02-20 23:22:36 +00:00
parent 7b0871cc74
commit 0068408001
1 changed files with 4 additions and 0 deletions

View File

@ -307,6 +307,10 @@ StringRef getMachineName(llvm::COFF::MachineTypes Type) {
} }
std::error_code FileCOFF::doParse() { 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()); auto binaryOrErr = llvm::object::createBinary(_mb->getMemBufferRef());
if (std::error_code ec = binaryOrErr.getError()) if (std::error_code ec = binaryOrErr.getError())
return ec; return ec;