Skip to content

Commit d0052eb

Browse files
committed
[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 (4f03258).
1 parent 79cbad1 commit d0052eb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -833,14 +833,7 @@ Error LLJITBuilderState::prepareForConstruction() {
833833
CreateObjectLinkingLayer =
834834
[](ExecutionSession &ES,
835835
const Triple &) -> Expected<std::unique_ptr<ObjectLayer>> {
836-
auto ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(ES);
837-
if (auto EHFrameRegistrar = EPCEHFrameRegistrar::Create(ES))
838-
ObjLinkingLayer->addPlugin(
839-
std::make_unique<EHFrameRegistrationPlugin>(
840-
ES, std::move(*EHFrameRegistrar)));
841-
else
842-
return EHFrameRegistrar.takeError();
843-
return std::move(ObjLinkingLayer);
836+
return std::make_unique<ObjectLinkingLayer>(ES);
844837
};
845838
}
846839
}
@@ -1225,6 +1218,16 @@ Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J) {
12251218
auto &PlatformJD = J.getExecutionSession().createBareJITDylib("<Platform>");
12261219
PlatformJD.addToLinkOrder(*ProcessSymbolsJD);
12271220

1221+
if (auto *OLL = dyn_cast<ObjectLinkingLayer>(&J.getObjLinkingLayer())) {
1222+
1223+
auto &ES = J.getExecutionSession();
1224+
if (auto EHFrameRegistrar = EPCEHFrameRegistrar::Create(ES))
1225+
OLL->addPlugin(std::make_unique<EHFrameRegistrationPlugin>(
1226+
ES, std::move(*EHFrameRegistrar)));
1227+
else
1228+
return EHFrameRegistrar.takeError();
1229+
}
1230+
12281231
J.setPlatformSupport(
12291232
std::make_unique<GenericLLVMIRPlatformSupport>(J, PlatformJD));
12301233

0 commit comments

Comments
 (0)