|
7 | 7 | //===----------------------------------------------------------------------===//
|
8 | 8 |
|
9 | 9 | #include "llvm/ExecutionEngine/Orc/LLJIT.h"
|
| 10 | + |
| 11 | +#include "llvm/Analysis/TargetLibraryInfo.h" |
10 | 12 | #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_THREADS
|
11 | 13 | #include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
|
12 | 14 | #include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
|
@@ -195,10 +197,14 @@ class GenericLLVMIRPlatformSupport : public LLJIT::PlatformSupport {
|
195 | 197 | auto *IntTy = Type::getIntNTy(*Ctx, sizeof(int) * CHAR_BIT);
|
196 | 198 | auto *AtExitCallbackTy = FunctionType::get(VoidTy, {}, false);
|
197 | 199 | auto *AtExitCallbackPtrTy = PointerType::getUnqual(AtExitCallbackTy);
|
198 |
| - addHelperAndWrapper(*M, "atexit", |
199 |
| - FunctionType::get(IntTy, {AtExitCallbackPtrTy}, false), |
200 |
| - GlobalValue::HiddenVisibility, "__lljit.atexit_helper", |
201 |
| - {PlatformInstanceDecl, DSOHandle}); |
| 200 | + auto *AtExit = addHelperAndWrapper( |
| 201 | + *M, "atexit", FunctionType::get(IntTy, {AtExitCallbackPtrTy}, false), |
| 202 | + GlobalValue::HiddenVisibility, "__lljit.atexit_helper", |
| 203 | + {PlatformInstanceDecl, DSOHandle}); |
| 204 | + Attribute::AttrKind AtExitExtAttr = |
| 205 | + TargetLibraryInfo::getExtAttrForI32Return(J.getTargetTriple()); |
| 206 | + if (AtExitExtAttr != Attribute::None) |
| 207 | + AtExit->addRetAttr(AtExitExtAttr); |
202 | 208 |
|
203 | 209 | return J.addIRModule(JD, ThreadSafeModule(std::move(M), std::move(Ctx)));
|
204 | 210 | }
|
|
0 commit comments