[PATCH] D93184: Make lld::wasm::link() or lld::elf::link() more thread-safe

Sean Young via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 13 12:37:21 PST 2020


seanyoung created this revision.
seanyoung added reviewers: ruiu, lhames, kledzik, sbc100, smeenai, gkm, int3.
seanyoung added a project: lld.
Herald added subscribers: sunfish, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: MaskRay.
seanyoung requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

lld::wasm::link() or lld::elf::link() call InitializeAllTargets() which is not thread-safe if another thread is attempting to use the llvm libraries.

      

This is an issue for Solang:

  
  https://github.com/hyperledger-labs/solang/blob/master/src/linker/linker.cpp


It uses ldd by calling lld::wasm::link() but another thread might be trying to build an llvm module, which fails if InitializeAllTargets() gets called.

      

Ideally I'd like to make lld entirely thread-safe and more amiable for using as a a library, that is a much larger change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93184

Files:
  lld/COFF/Driver.cpp
  lld/ELF/Driver.cpp
  lld/MachO/Driver.cpp
  lld/tools/lld/lld.cpp
  lld/wasm/Driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93184.311466.patch
Type: text/x-patch
Size: 4778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201213/bb06767c/attachment.bin>


More information about the llvm-commits mailing list