summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-03-20 00:06:04 +0000
committerRui Ueyama <ruiu@google.com>2014-03-20 00:06:04 +0000
commit5f56e9d6cb2f5641c7537a7a2a5529c62107fe36 (patch)
treea7daf75c913d4e13a05fa2388793b00ebc80e8f9
parentc49d0d4fe6eb9ab66a14049e220fd34d72473fb5 (diff)
downloadbcm5719-llvm-5f56e9d6cb2f5641c7537a7a2a5529c62107fe36.tar.gz
bcm5719-llvm-5f56e9d6cb2f5641c7537a7a2a5529c62107fe36.zip
[PECOFF] Fix parallel read bug.
InputElement::parse() may recursively call WinLinkDriver::parse() to handle .drectve section contents, and if /defaultlib option exists in the section, the driver will mutate the input graph to add a new input file to the graph. So the access to input graph needs to be protected with mutext. llvm-svn: 204285
-rw-r--r--lld/include/lld/Driver/WinLinkInputGraph.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/lld/include/lld/Driver/WinLinkInputGraph.h b/lld/include/lld/Driver/WinLinkInputGraph.h
index 9c798007124..4d5e4339037 100644
--- a/lld/include/lld/Driver/WinLinkInputGraph.h
+++ b/lld/include/lld/Driver/WinLinkInputGraph.h
@@ -66,10 +66,14 @@ public:
/// \brief Parse the group members.
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
+ auto *pctx = (PECOFFLinkingContext *)(&ctx);
+ error_code ec = error_code::success();
+ pctx->lock();
for (auto &elem : _elements)
- if (error_code ec = elem->parse(ctx, diagnostics))
- return ec;
- return error_code::success();
+ if ((ec = elem->parse(ctx, diagnostics)))
+ break;
+ pctx->unlock();
+ return ec;
}
};
OpenPOWER on IntegriCloud