[llvm] [Orc] Fix error handling in `ORCPlatformSupport::initialize` (PR #144637)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 17 22:14:18 PDT 2025
https://github.com/SahilPatidar created https://github.com/llvm/llvm-project/pull/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.
>From df066d5040e791b4d65bbaf2ff42a56d58bda81b Mon Sep 17 00:00:00 2001
From: SahilPatidar <patidarsahil2001 at gmail.com>
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<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