[ORC][LLJIT] Install eh-frame registration plugin during platform setup.
Attempt to install the EHFrameRegistrationPlugin during GenericLLVMIRPlatform
setup, rather than object linking layer creation time.
Platform classes are responsible for exception handling: installing the plugin
unconditionally during linking-layer construction could result in frames being
registered more than once when native platform classes are used.
This is a precursor to re-landing compact unwind support (4f0325873f).
This commit is contained in:
@@ -833,14 +833,7 @@ Error LLJITBuilderState::prepareForConstruction() {
|
||||
CreateObjectLinkingLayer =
|
||||
[](ExecutionSession &ES,
|
||||
const Triple &) -> Expected<std::unique_ptr<ObjectLayer>> {
|
||||
auto ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(ES);
|
||||
if (auto EHFrameRegistrar = EPCEHFrameRegistrar::Create(ES))
|
||||
ObjLinkingLayer->addPlugin(
|
||||
std::make_unique<EHFrameRegistrationPlugin>(
|
||||
ES, std::move(*EHFrameRegistrar)));
|
||||
else
|
||||
return EHFrameRegistrar.takeError();
|
||||
return std::move(ObjLinkingLayer);
|
||||
return std::make_unique<ObjectLinkingLayer>(ES);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1225,6 +1218,16 @@ Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J) {
|
||||
auto &PlatformJD = J.getExecutionSession().createBareJITDylib("<Platform>");
|
||||
PlatformJD.addToLinkOrder(*ProcessSymbolsJD);
|
||||
|
||||
if (auto *OLL = dyn_cast<ObjectLinkingLayer>(&J.getObjLinkingLayer())) {
|
||||
|
||||
auto &ES = J.getExecutionSession();
|
||||
if (auto EHFrameRegistrar = EPCEHFrameRegistrar::Create(ES))
|
||||
OLL->addPlugin(std::make_unique<EHFrameRegistrationPlugin>(
|
||||
ES, std::move(*EHFrameRegistrar)));
|
||||
else
|
||||
return EHFrameRegistrar.takeError();
|
||||
}
|
||||
|
||||
J.setPlatformSupport(
|
||||
std::make_unique<GenericLLVMIRPlatformSupport>(J, PlatformJD));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user