[lld] r237217 - [LLD] Add a mutex to prevent concurrent modification of the dylib maps in

Lang Hames lhames at gmail.com
Tue May 12 17:17:09 PDT 2015


Author: lhames
Date: Tue May 12 19:17:08 2015
New Revision: 237217

URL: http://llvm.org/viewvc/llvm-project?rev=237217&view=rev
Log:
[LLD] Add a mutex to prevent concurrent modification of the dylib maps in
MachOLinkingContext.

Modified:
    lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
    lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp

Modified: lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=237217&r1=237216&r2=237217&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h Tue May 12 19:17:08 2015
@@ -355,6 +355,7 @@ private:
   mutable std::set<mach_o::MachODylibFile*> _allDylibs;
   mutable std::set<mach_o::MachODylibFile*> _upwardDylibs;
   mutable std::vector<std::unique_ptr<File>> _indirectDylibs;
+  mutable std::mutex _dylibsMutex;
   ExportMode _exportMode;
   llvm::StringSet<> _exportedSymbols;
   DebugInfoMode _debugInfoMode;

Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=237217&r1=237216&r2=237217&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Tue May 12 19:17:08 2015
@@ -705,6 +705,7 @@ void MachOLinkingContext::createImplicit
 
 void MachOLinkingContext::registerDylib(MachODylibFile *dylib,
                                         bool upward) const {
+  std::lock_guard<std::mutex> lock(_dylibsMutex);
   _allDylibs.insert(dylib);
   _pathToDylibMap[dylib->installName()] = dylib;
   // If path is different than install name, register path too.





More information about the llvm-commits mailing list