[LLJIT] Default to EPCEHFrameRegistrar rather than InProcessEHFrameRegistrar.

Now that ExecutionSession objects alway have ExecutorProcessControl (EPC)
objects attached we can use EPCEHFrameRegistrar by default, rather than
InProcessEHFrameRegistrar. This allows LLJIT to work out-of-the-box with remote
EPCs on platforms that use JITLink, without requiring a custom
ObjectLinkingLayerCreator to override the eh-frame registrar.
This commit is contained in:
Lang Hames
2022-10-09 21:54:09 -07:00
parent 6b24bdb4a5
commit aedeb8d557

View File

@@ -9,6 +9,7 @@
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h"
#include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h"
#include "llvm/ExecutionEngine/Orc/MachOPlatform.h"
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
@@ -723,8 +724,12 @@ Error LLJITBuilderState::prepareForConstruction() {
[](ExecutionSession &ES,
const Triple &) -> Expected<std::unique_ptr<ObjectLayer>> {
auto ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(ES);
ObjLinkingLayer->addPlugin(std::make_unique<EHFrameRegistrationPlugin>(
ES, std::make_unique<jitlink::InProcessEHFrameRegistrar>()));
if (auto EHFrameRegistrar = EPCEHFrameRegistrar::Create(ES))
ObjLinkingLayer->addPlugin(
std::make_unique<EHFrameRegistrationPlugin>(
ES, std::move(*EHFrameRegistrar)));
else
return EHFrameRegistrar.takeError();
return std::move(ObjLinkingLayer);
};
}