Skip to content

Commit d733c8e

Browse files
[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@gmail.com>
1 parent 91cc33f commit d733c8e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,16 +632,19 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
632632
int32_t result;
633633
auto E = ES.callSPSWrapper<SPSDLUpdateSig>(WrapperAddr->getAddress(),
634634
result, DSOHandles[&JD]);
635-
if (result)
635+
if (E)
636+
return E;
637+
else if (result)
636638
return make_error<StringError>("dlupdate failed",
637639
inconvertibleErrorCode());
638-
return E;
639-
}
640-
return ES.callSPSWrapper<SPSDLOpenSig>(WrapperAddr->getAddress(),
641-
DSOHandles[&JD], JD.getName(),
642-
int32_t(ORC_RT_RTLD_LAZY));
640+
} else
641+
return ES.callSPSWrapper<SPSDLOpenSig>(WrapperAddr->getAddress(),
642+
DSOHandles[&JD], JD.getName(),
643+
int32_t(ORC_RT_RTLD_LAZY));
643644
} else
644645
return WrapperAddr.takeError();
646+
647+
return Error::success();
645648
}
646649

647650
Error ORCPlatformSupport::deinitialize(orc::JITDylib &JD) {

0 commit comments

Comments
 (0)