diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-02-20 23:22:36 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-02-20 23:22:36 +0000 |
| commit | 0068408001bcf21ac629808cd6b3a04a0a21a192 (patch) | |
| tree | 3f447d59df61a45b2de02f816a582d5314c2e54c | |
| parent | 7b0871cc742be754e6c7ecc92c9cd8b8f4e5ae80 (diff) | |
| download | bcm5719-llvm-0068408001bcf21ac629808cd6b3a04a0a21a192.tar.gz bcm5719-llvm-0068408001bcf21ac629808cd6b3a04a0a21a192.zip | |
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
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index 27d26c84985..9756feeed3a 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -307,6 +307,10 @@ StringRef getMachineName(llvm::COFF::MachineTypes Type) { } 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; |

