[llvm] d733c8e - [Orc] Fix error handling in `ORCPlatformSupport::initialize` (#144637)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 6 23:08:18 PDT 2025


Author: SahilPatidar
Date: 2025-07-07T11:38:14+05:30
New Revision: d733c8e5c584cfaf6c8650d3a40328c7bcfbe07c

URL: https://github.com/llvm/llvm-project/commit/d733c8e5c584cfaf6c8650d3a40328c7bcfbe07c
DIFF: https://github.com/llvm/llvm-project/commit/d733c8e5c584cfaf6c8650d3a40328c7bcfbe07c.diff

LOG: [Orc] Fix error handling in `ORCPlatformSupport::initialize` (#144637)

Previously, `result` was checked before handling the `Error` returned by
`callSPSWrapper`. If `Error` was `success` but `result` indicated
failure, the original `Error` was silently dropped, triggering an
assertion failure for unhandled `Error`.

This patch ensures the `Error` is checked and returned before inspecting
`result`, preventing assertion failures.

Co-authored-by: Anutosh Bhat <andersonbhat491 at gmail.com>

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 4e3c09e970cbe..67bb7dd8ad08f 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -632,16 +632,19 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
       int32_t result;
       auto E = ES.callSPSWrapper<SPSDLUpdateSig>(WrapperAddr->getAddress(),
                                                  result, DSOHandles[&JD]);
-      if (result)
+      if (E)
+        return E;
+      else if (result)
         return make_error<StringError>("dlupdate failed",
                                        inconvertibleErrorCode());
-      return E;
-    }
-    return ES.callSPSWrapper<SPSDLOpenSig>(WrapperAddr->getAddress(),
-                                           DSOHandles[&JD], JD.getName(),
-                                           int32_t(ORC_RT_RTLD_LAZY));
+    } else
+      return ES.callSPSWrapper<SPSDLOpenSig>(WrapperAddr->getAddress(),
+                                             DSOHandles[&JD], JD.getName(),
+                                             int32_t(ORC_RT_RTLD_LAZY));
   } else
     return WrapperAddr.takeError();
+
+  return Error::success();
 }
 
 Error ORCPlatformSupport::deinitialize(orc::JITDylib &JD) {


        


More information about the llvm-commits mailing list