[llvm] [JIT] Fix crash in unit tests (PR #113492)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 13:34:51 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);
----------------
redstar wrote:

Done. yw.

https://github.com/llvm/llvm-project/pull/113492


More information about the llvm-commits mailing list