parent
ec762bda73
commit
9e8ac37d89
|
@ -115,9 +115,6 @@ public:
|
|||
bool isDirective = false);
|
||||
|
||||
private:
|
||||
static bool doParse(int argc, const char *argv[], PECOFFLinkingContext &info,
|
||||
raw_ostream &diagnostics, bool isDirective);
|
||||
|
||||
WinLinkDriver() LLVM_DELETED_FUNCTION;
|
||||
};
|
||||
|
||||
|
|
|
@ -67,13 +67,11 @@ 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();
|
||||
std::lock_guard<std::recursive_mutex> lock(pctx->getMutex());
|
||||
for (auto &elem : _elements)
|
||||
if ((ec = elem->parse(ctx, diagnostics)))
|
||||
break;
|
||||
pctx->unlock();
|
||||
return ec;
|
||||
if (error_code ec = elem->parse(ctx, diagnostics))
|
||||
return ec;
|
||||
return error_code::success();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -265,8 +265,7 @@ public:
|
|||
void setLibraryGroup(Group *group) { _libraryGroup = group; }
|
||||
Group *getLibraryGroup() const { return _libraryGroup; }
|
||||
|
||||
void lock() { _mutex.lock(); }
|
||||
void unlock() { _mutex.unlock(); }
|
||||
std::recursive_mutex &getMutex() { return _mutex; }
|
||||
|
||||
protected:
|
||||
/// Method to create a internal file for the entry symbol
|
||||
|
|
|
@ -780,9 +780,14 @@ bool WinLinkDriver::linkPECOFF(int argc, const char **argv, raw_ostream &diag) {
|
|||
return link(context, diag);
|
||||
}
|
||||
|
||||
bool WinLinkDriver::doParse(int argc, const char *argv[],
|
||||
PECOFFLinkingContext &ctx, raw_ostream &diag,
|
||||
bool isReadingDirectiveSection) {
|
||||
bool WinLinkDriver::parse(int argc, const char *argv[],
|
||||
PECOFFLinkingContext &ctx, raw_ostream &diag,
|
||||
bool isReadingDirectiveSection) {
|
||||
// Parse may be called from multiple threads simultaneously to parse .drectve
|
||||
// sections. This function is not thread-safe because it mutates the context
|
||||
// object. So acquire the lock.
|
||||
std::lock_guard<std::recursive_mutex> lock(ctx.getMutex());
|
||||
|
||||
std::map<StringRef, StringRef> failIfMismatchMap;
|
||||
// Parse the options.
|
||||
std::unique_ptr<llvm::opt::InputArgList> parsedArgs =
|
||||
|
@ -1260,16 +1265,4 @@ bool WinLinkDriver::doParse(int argc, const char *argv[],
|
|||
return ctx.validate(diag);
|
||||
}
|
||||
|
||||
// Parse may be called from multiple threads simultaneously to parse .drectve
|
||||
// sections. doParse() is not thread-safe because it mutates the context
|
||||
// object. This function wraps doParse() with a mutex.
|
||||
bool WinLinkDriver::parse(int argc, const char *argv[],
|
||||
PECOFFLinkingContext &ctx, raw_ostream &diag,
|
||||
bool isReadingDirectiveSection) {
|
||||
ctx.lock();
|
||||
bool r = doParse(argc, argv, ctx, diag, isReadingDirectiveSection);
|
||||
ctx.unlock();
|
||||
return r;
|
||||
}
|
||||
|
||||
} // namespace lld
|
||||
|
|
Loading…
Reference in New Issue