[llvm] 4245c00 - [ORC] Fix LLJIT's atexit declaration for clang-repl on SystemZ.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 21:54:51 PDT 2024
Author: Lang Hames
Date: 2024-10-16T15:54:45+11:00
New Revision: 4245c00faf5eb525ea9167c7a30c6cfe260b8676
URL: https://github.com/llvm/llvm-project/commit/4245c00faf5eb525ea9167c7a30c6cfe260b8676
DIFF: https://github.com/llvm/llvm-project/commit/4245c00faf5eb525ea9167c7a30c6cfe260b8676.diff
LOG: [ORC] Fix LLJIT's atexit declaration for clang-repl on SystemZ.
The atexit needs a signext attribute on its return type. See
https://github.com/llvm/llvm-project/issues/109658.
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 7e3f58c0059c9d..c56ec196772b38 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -7,6 +7,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
+
+#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_THREADS
#include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
@@ -195,10 +197,14 @@ class GenericLLVMIRPlatformSupport : public LLJIT::PlatformSupport {
auto *IntTy = Type::getIntNTy(*Ctx, sizeof(int) * CHAR_BIT);
auto *AtExitCallbackTy = FunctionType::get(VoidTy, {}, false);
auto *AtExitCallbackPtrTy = PointerType::getUnqual(AtExitCallbackTy);
- addHelperAndWrapper(*M, "atexit",
- FunctionType::get(IntTy, {AtExitCallbackPtrTy}, false),
- GlobalValue::HiddenVisibility, "__lljit.atexit_helper",
- {PlatformInstanceDecl, DSOHandle});
+ auto *AtExit = addHelperAndWrapper(
+ *M, "atexit", FunctionType::get(IntTy, {AtExitCallbackPtrTy}, false),
+ GlobalValue::HiddenVisibility, "__lljit.atexit_helper",
+ {PlatformInstanceDecl, DSOHandle});
+ Attribute::AttrKind AtExitExtAttr =
+ TargetLibraryInfo::getExtAttrForI32Return(J.getTargetTriple());
+ if (AtExitExtAttr != Attribute::None)
+ AtExit->addRetAttr(AtExitExtAttr);
return J.addIRModule(JD, ThreadSafeModule(std::move(M), std::move(Ctx)));
}
More information about the llvm-commits
mailing list