Fix MLIR Build after LLVM upstream JIT changes (getMainJITDylib removed)

The getMainJITDylib() method was removed in 4fc68b9b7f, replace it by creating a JITDylib on the fly.

PiperOrigin-RevId: 283948595
This commit is contained in:
Mehdi Amini 2019-12-05 04:32:13 -08:00 committed by A. Unique TensorFlower
parent b8cd0c1486
commit b14ee5a9a1
1 changed files with 4 additions and 1 deletions

View File

@ -234,9 +234,12 @@ Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
auto objectLayer = std::make_unique<RTDyldObjectLinkingLayer>(
session, []() { return std::make_unique<SectionMemoryManager>(); });
auto dataLayout = deserModule->getDataLayout();
llvm::orc::JITDylib *mainJD = session.getJITDylibByName("<main>");
if (!mainJD)
mainJD = &session.createJITDylib("<main>");
// Resolve symbols that are statically linked in the current process.
session.getMainJITDylib().addGenerator(
mainJD->addGenerator(
cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
dataLayout.getGlobalPrefix())));