[llvm] [JIT] Fix crash in unit tests (PR #113492)
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 13:28:59 PDT 2024
================
@@ -26,11 +26,16 @@ class JITLinkRedirectableSymbolManager : public RedirectableSymbolManager,
/// Create redirection manager that uses JITLink based implementaion.
static Expected<std::unique_ptr<RedirectableSymbolManager>>
Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &JD) {
- Error Err = Error::success();
+ auto AnonymousPtrCreator(jitlink::getAnonymousPointerCreator(
+ ObjLinkingLayer.getExecutionSession().getTargetTriple()));
+ auto PtrJumpStubCreator(jitlink::getPointerJumpStubCreator(
+ ObjLinkingLayer.getExecutionSession().getTargetTriple()));
+ if (!AnonymousPtrCreator || !PtrJumpStubCreator)
+ return make_error<StringError>("Architecture not supported",
+ inconvertibleErrorCode());
auto RM = std::unique_ptr<RedirectableSymbolManager>(
- new JITLinkRedirectableSymbolManager(ObjLinkingLayer, JD, Err));
- if (Err)
- return Err;
+ new JITLinkRedirectableSymbolManager(
+ ObjLinkingLayer, JD, AnonymousPtrCreator, PtrJumpStubCreator));
return std::move(RM);
----------------
lhames wrote:
It would be good to just return the object here, rather than naming it then returning it, but otherwise LGTM. Thanks @redstar!
https://github.com/llvm/llvm-project/pull/113492
More information about the llvm-commits
mailing list