Skip to content

Commit 53c90d9

Browse files
raulcdlriggs
authored andcommitted
apacheGH-47469: [C++][Gandiva] Add support for LLVM 21.1.0 (apache#47473)
LLVM 21.1 was released and some of our CI jobs are failing. * Accept LLVM 21.1 * Don't use deprecated API Two of the related commits that changed APIs on LLVM are: - llvm/llvm-project@034f2b3 - llvm/llvm-project@b18e5b6 Yes on CI No * GitHub Issue: apache#47469 Authored-by: Raúl Cumplido <raulcumplido@gmail.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent 3ad0370 commit 53c90d9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cpp/src/gandiva/engine.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,16 @@ Status UseJITLinkIfEnabled(llvm::orc::LLJITBuilder& jit_builder) {
200200
static auto maybe_use_jit_link = ::arrow::internal::GetEnvVar("GANDIVA_USE_JIT_LINK");
201201
if (maybe_use_jit_link.ok()) {
202202
ARROW_ASSIGN_OR_RAISE(static auto memory_manager, CreateMemmoryManager());
203+
# if LLVM_VERSION_MAJOR >= 21
204+
jit_builder.setObjectLinkingLayerCreator([&](llvm::orc::ExecutionSession& ES) {
205+
return std::make_unique<llvm::orc::ObjectLinkingLayer>(ES, *memory_manager);
206+
});
207+
# else
203208
jit_builder.setObjectLinkingLayerCreator(
204209
[&](llvm::orc::ExecutionSession& ES, const llvm::Triple& TT) {
205210
return std::make_unique<llvm::orc::ObjectLinkingLayer>(ES, *memory_manager);
206211
});
212+
# endif
207213
}
208214
return Status::OK();
209215
}

cpp/src/gandiva/llvm_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ class GANDIVA_EXPORT LLVMTypes {
5656
llvm::Type* double_type() { return llvm::Type::getDoubleTy(context_); }
5757

5858
llvm::PointerType* ptr_type(llvm::Type* type) {
59+
#if LLVM_VERSION_MAJOR >= 21
60+
return llvm::PointerType::get(context_, 0);
61+
#else
5962
return llvm::PointerType::get(type, 0);
63+
#endif
6064
}
6165

6266
llvm::PointerType* i8_ptr_type() { return ptr_type(i8_type()); }

0 commit comments

Comments
 (0)