[llvm] 0a1f780 - [NFCI][llvm-jitlink] Return 1 instead of exit(1) on entry point error (#228311)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 4 19:30:42 PDT 2026
Author: Vitaly Buka
Date: 2026-10-05T02:30:35Z
New Revision: 0a1f78094619685f3a2915c953f8ffd95d4ab86e
URL: https://github.com/llvm/llvm-project/commit/0a1f78094619685f3a2915c953f8ffd95d4ab86e
DIFF: https://github.com/llvm/llvm-project/commit/0a1f78094619685f3a2915c953f8ffd95d4ab86e.diff
LOG: [NFCI][llvm-jitlink] Return 1 instead of exit(1) on entry point error (#228311)
In main(), if EntryPoint lookup fails, llvm-jitlink was calling
exit(1). Because exit() is noreturn, the stack is not unwound and
destructors for Session S and its associated objects are not run.
LSan detects these in-flight allocations (such as dlsym buffers
in InProcessDylibManager) as memory leaks at atexit, causing
ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s
to fail on ASan/LSan buildbots.
Returning 1 from main() allows S and other local variables to be cleanly
destructed before process termination.
For https://github.com/llvm/llvm-project/issues/186534
Fixes https://lab.llvm.org/buildbot/#/builders/169/builds/27104
Log:
https://lab.llvm.org/buildbot/#/builders/169/builds/27104/steps/11/logs/stdio
Assisted-by: Gemini
Added:
Modified:
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index d6b0d0e59666e..0bc4112fd94e4 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -3212,7 +3212,7 @@ int main(int argc, char *argv[]) {
Timers->JITLinkTG.printAll(errs());
reportLLVMJITLinkError(EntryPoint.takeError());
ExitOnErr(S->ES.endSession());
- exit(1);
+ return 1;
}
ExitOnErr(runChecks(*S, std::move(TT), std::move(Features)));
More information about the llvm-commits
mailing list