@@ -31,6 +31,10 @@ __pragma(warning(push))
3131#include " llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
3232#include " llvm/ExecutionEngine/SectionMemoryManager.h"
3333
34+ #if LLVM_VERSION_MAJOR >= 21
35+ #include " llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h"
36+ #endif
37+
3438#if LLVM_VERSION_MAJOR >= 20
3539 #include " llvm/ExecutionEngine/Orc/AbsoluteSymbols.h"
3640#endif
@@ -41,6 +45,10 @@ __pragma(warning(push))
4145#include " llvm/Support/CommandLine.h"
4246#include " llvm/Support/TargetSelect.h"
4347#include " llvm/TargetParser/Host.h"
48+ #if LLVM_VERSION_MAJOR >= 21
49+ #include " llvm/TargetParser/Triple.h"
50+ #include " llvm/Support/MemoryBuffer.h"
51+ #endif
4452#include " llvm/Transforms/InstCombine/InstCombine.h"
4553#include " llvm/Transforms/Instrumentation/MemorySanitizer.h"
4654#include " llvm/Transforms/Scalar/ADCE.h"
@@ -749,9 +757,17 @@ class JITRoutine : public rr::Routine
749757 return std::move (*p);
750758 }())
751759#endif
752- , objectLayer(session, [this ]() {
753- return std::make_unique<llvm::SectionMemoryManager>(&memoryMapper);
754- })
760+ , objectLayer(session,
761+ #if LLVM_VERSION_MAJOR >= 21
762+ [this ](const llvm::MemoryBuffer &) {
763+ return std::make_unique<llvm::SectionMemoryManager>(&memoryMapper);
764+ }
765+ #else
766+ [this ]() {
767+ return std::make_unique<llvm::SectionMemoryManager>(&memoryMapper);
768+ }
769+ #endif
770+ )
755771 , addresses(count)
756772 {
757773 bool fatalCompileIssue = false ;
@@ -873,7 +889,11 @@ JITBuilder::JITBuilder(const rr::Config &config)
873889 , module (new llvm::Module(" " , *context))
874890 , builder(new llvm::IRBuilder<>(*context))
875891{
892+ #if LLVM_VERSION_MAJOR >= 21
893+ module ->setTargetTriple (llvm::Triple (LLVM_DEFAULT_TARGET_TRIPLE ));
894+ #else
876895 module ->setTargetTriple (LLVM_DEFAULT_TARGET_TRIPLE );
896+ #endif
877897 module ->setDataLayout (JITGlobals::get ()->getDataLayout ());
878898 if (config.getOptimization ().getFMF () == Optimization::FMF ::FastMath)
879899 builder->setFastMathFlags (llvm::FastMathFlags::getFast ());
0 commit comments