File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -669,7 +669,17 @@ bool CGen8OpenCLProgram::GetZEBinary(
669
669
llvm::raw_string_ostream linkOut (linkOutStr);
670
670
671
671
constexpr bool canExitEarly = false ;
672
- if (IGCLLD::elf::link (elfArrRef, canExitEarly, linkOut, linkErr))
672
+ bool linked = false ;
673
+ {
674
+ // LLD is not assured to be thread-safe.
675
+ // Mutex can be removed as soon as thread-safety is implemented in future versions of LLVM.
676
+ static std::mutex linkerMtx;
677
+ std::lock_guard<std::mutex> lck (linkerMtx);
678
+ linked =
679
+ IGCLLD::elf::link (elfArrRef, canExitEarly, linkOut, linkErr);
680
+ }
681
+
682
+ if (linked)
673
683
{
674
684
// Multiple ELF files linked.
675
685
// Copy the data from the linked file to a memory, what will be a source location
You can’t perform that action at this time.
0 commit comments