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

Hans Wennborg hans at chromium.org
Wed Jul 22 14:25:02 PDT 2015


Was this a fix for PR24205, or is it just that the bug no longer
reproduces at this revision? If it's the former, should we merge this
to 3.7?

Thanks,
Hans

On Wed, Jul 22, 2015 at 3:32 AM, Simon Atanasyan <simon at atanasyan.com> wrote:
> Author: atanasyan
> Date: Wed Jul 22 05:32:19 2015
> New Revision: 242885
>
> URL: http://llvm.org/viewvc/llvm-project?rev=242885&view=rev
> Log:
> [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/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>     lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
>
> Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=242885&r1=242884&r2=242885&view=diff
> ==============================================================================
> --- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
> +++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Wed Jul 22 05:32:19 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/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=242885&r1=242884&r2=242885&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Wed Jul 22 05:32:19 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list