Index: llvm/lib/ExecutionEngine/Orc/Core.cpp =================================================================== --- llvm/lib/ExecutionEngine/Orc/Core.cpp +++ llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -1611,11 +1611,13 @@ } JITDylib *ExecutionSession::getJITDylibByName(std::string Name) { - for (auto &JD : JDs) { - if (JD->getName() == Name) - return JD.get(); - } - return nullptr; + return runSessionLocked([&, this]() -> JITDylib * { + for (auto &JD : JDs) { + if (JD->getName() == Name) + return JD.get(); + } + return nullptr; + }); } JITDylib &ExecutionSession::createJITDylib(std::string Name,