From df066d5040e791b4d65bbaf2ff42a56d58bda81b Mon Sep 17 00:00:00 2001 From: SahilPatidar Date: Wed, 18 Jun 2025 10:27:31 +0530 Subject: [PATCH] [Orc] Fix error handling in `ORCPlatformSupport::initialize` --- llvm/lib/ExecutionEngine/Orc/LLJIT.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp index 21ebe82c8a71a..b5681f19bfd04 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(WrapperAddr->getAddress(), result, DSOHandles[&JD]); - if (result) + if (E) + return E; + else if (result) return make_error("dlupdate failed", inconvertibleErrorCode()); - return E; - } - return ES.callSPSWrapper(WrapperAddr->getAddress(), - DSOHandles[&JD], JD.getName(), - int32_t(ORC_RT_RTLD_LAZY)); + } else + return ES.callSPSWrapper(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) {