[PATCH] D94690: [Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors
Stefan Gränitz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 03:54:45 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcf905274c6f4: [Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors (authored by sgraenitz).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94690/new/
https://reviews.llvm.org/D94690
Files:
llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
Index: llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -954,8 +954,9 @@
JTMB->setRelocationModel(Reloc::PIC_);
JTMB->setCodeModel(CodeModel::Small);
CreateObjectLinkingLayer =
- [TPC = this->TPC](ExecutionSession &ES,
- const Triple &) -> std::unique_ptr<ObjectLayer> {
+ [TPC = this->TPC](
+ ExecutionSession &ES,
+ const Triple &) -> Expected<std::unique_ptr<ObjectLayer>> {
std::unique_ptr<ObjectLinkingLayer> ObjLinkingLayer;
if (TPC)
ObjLinkingLayer =
@@ -1011,7 +1012,7 @@
makeJITDylibSearchOrder(&JD, JITDylibLookupFlags::MatchAllSymbols), Name);
}
-std::unique_ptr<ObjectLayer>
+Expected<std::unique_ptr<ObjectLayer>>
LLJIT::createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES) {
// If the config state provided an ObjectLinkingLayer factory then use it.
@@ -1057,8 +1058,7 @@
LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
: ES(S.ES ? std::move(S.ES) : std::make_unique<ExecutionSession>()), Main(),
- DL(""), TT(S.JTMB->getTargetTriple()),
- ObjLinkingLayer(createObjectLinkingLayer(S, *ES)) {
+ DL(""), TT(S.JTMB->getTargetTriple()) {
ErrorAsOutParameter _(&Err);
@@ -1078,6 +1078,12 @@
return;
}
+ auto ObjLayer = createObjectLinkingLayer(S, *ES);
+ if (!ObjLayer) {
+ Err = ObjLayer.takeError();
+ return;
+ }
+ ObjLinkingLayer = std::move(*ObjLayer);
ObjTransformLayer =
std::make_unique<ObjectTransformLayer>(*ES, *ObjLinkingLayer);
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -186,7 +186,7 @@
}
protected:
- static std::unique_ptr<ObjectLayer>
+ static Expected<std::unique_ptr<ObjectLayer>>
createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES);
static Expected<std::unique_ptr<IRCompileLayer::IRCompiler>>
@@ -250,8 +250,9 @@
class LLJITBuilderState {
public:
- using ObjectLinkingLayerCreator = std::function<std::unique_ptr<ObjectLayer>(
- ExecutionSession &, const Triple &TT)>;
+ using ObjectLinkingLayerCreator =
+ std::function<Expected<std::unique_ptr<ObjectLayer>>(ExecutionSession &,
+ const Triple &)>;
using CompileFunctionCreator =
std::function<Expected<std::unique_ptr<IRCompileLayer::IRCompiler>>(
Index: llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
===================================================================
--- llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
+++ llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
@@ -147,7 +147,7 @@
ES, std::make_unique<jitlink::InProcessMemoryManager>());
// Add an instance of our plugin.
ObjLinkingLayer->addPlugin(std::make_unique<MyPlugin>());
- return ObjLinkingLayer;
+ return std::move(ObjLinkingLayer);
})
.create());
Index: llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
===================================================================
--- llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
+++ llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
@@ -78,7 +78,7 @@
// Make sure the debug info sections aren't stripped.
ObjLinkingLayer->setProcessAllSections(true);
- return ObjLinkingLayer;
+ return std::move(ObjLinkingLayer);
})
.create());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94690.316899.patch
Type: text/x-patch
Size: 4142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210115/955ccc35/attachment.bin>
More information about the llvm-commits
mailing list