diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-07-23 16:08:54 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-07-23 16:08:54 +0000 |
commit | f320b42d056a80e94e1cced2ff75c9e70da3201e (patch) | |
tree | d0a14fdcff254d68a23eebf0cba6b0e436509f47 | |
parent | 9a62418d3dbe88cf9d226cf6eba77a1f2695a375 (diff) |
Merging r242885:release_37
------------------------------------------------------------------------
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.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/lld/branches/release_37@243022 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/lld/ReaderWriter/ELFLinkingContext.h | 1 | ||||
-rw-r--r-- | lib/ReaderWriter/ELF/ELFLinkingContext.cpp | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/lld/ReaderWriter/ELFLinkingContext.h b/include/lld/ReaderWriter/ELFLinkingContext.h index b59d3604c..9cfc2f8d6 100644 --- a/include/lld/ReaderWriter/ELFLinkingContext.h +++ b/include/lld/ReaderWriter/ELFLinkingContext.h @@ -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 diff --git a/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lib/ReaderWriter/ELF/ELFLinkingContext.cpp index 70ed30a12..8c76a788f 100644 --- a/lib/ReaderWriter/ELF/ELFLinkingContext.cpp +++ b/lib/ReaderWriter/ELF/ELFLinkingContext.cpp @@ -254,8 +254,10 @@ void ELFLinkingContext::notifyInputSectionName(StringRef name) { 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 |