[lld] r243022 - Merging r242885:

Hans Wennborg hans at hanshq.net
Thu Jul 23 09:08:54 PDT 2015


Author: hans
Date: Thu Jul 23 11:08:54 2015
New Revision: 243022

URL: http://llvm.org/viewvc/llvm-project?rev=243022&view=rev
Log:
Merging r242885:
------------------------------------------------------------------------
r242885 | atanasyan | 2015-07-22 03:32:19 -0700 (Wed, 22 Jul 2015) | 4 lines

[ELF] Protect write access to the ELFLinkingContext::_cidentSections by a mutex

The _cidentSections container is filled during files parsing so we need to
serialize a concurrent access to it.
------------------------------------------------------------------------

Modified:
    lld/branches/release_37/   (props changed)
    lld/branches/release_37/include/lld/ReaderWriter/ELFLinkingContext.h
    lld/branches/release_37/lib/ReaderWriter/ELF/ELFLinkingContext.cpp

Propchange: lld/branches/release_37/
------------------------------------------------------------------------------
    svn:mergeinfo = /lld/trunk:242885

Modified: lld/branches/release_37/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_37/include/lld/ReaderWriter/ELFLinkingContext.h?rev=243022&r1=243021&r2=243022&view=diff
==============================================================================
--- lld/branches/release_37/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/branches/release_37/include/lld/ReaderWriter/ELFLinkingContext.h Thu Jul 23 11:08:54 2015
@@ -408,6 +408,7 @@ protected:
   std::map<std::string, uint64_t> _absoluteSymbols;
   llvm::StringSet<> _dynamicallyExportedSymbols;
   std::unique_ptr<File> _resolver;
+  std::mutex _cidentMutex;
   llvm::StringSet<> _cidentSections;
 
   // The linker script semantic object, which owns all script ASTs, is stored

Modified: lld/branches/release_37/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_37/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=243022&r1=243021&r2=243022&view=diff
==============================================================================
--- lld/branches/release_37/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/branches/release_37/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Thu Jul 23 11:08:54 2015
@@ -254,8 +254,10 @@ void ELFLinkingContext::notifyInputSecti
   if (name.find_first_not_of("0123456789"
                              "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                              "abcdefghijklmnopqrstuvwxyz"
-                             "_") == StringRef::npos)
+                             "_") == StringRef::npos) {
+    std::lock_guard<std::mutex> lock(_cidentMutex);
     _cidentSections.insert(name);
+  }
 }
 
 } // end namespace lld





More information about the llvm-commits mailing list