On 2025-09-12 14:47, Holger Hoffstätte wrote:
<snip>
I temporarily removed the __arch64__ guard and can reproduce the above error,
using either gcc-15 or clang-21. It seems this llvm monkey patch backport thing
is affected by the following commit in llvm-21:
https://github.com/llvm/llvm-project/commit/cd585864c0bbbd74ed2a2b1ccc191eed4d1c8f90
Trying to figure out how to adapt the code..
Try the attached patch on your homebrew setup.
This compiles and passes "make check", though I do not think it runs any jit
tests.
So intead I dropped this into my 17.6, disabled the __arch64__ guard to make
sure
I get the backport class, rebuilt and ran the jit on/off example from the docs.
This showed the expected performance difference with jit=on vs. off.
cheers
Holger
>From da8c15ef4f8dbfe931fe2700d849f49078bfca97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <[email protected]>
Date: Fri, 12 Sep 2025 16:01:15 +0200
Subject: [PATCH] jit: update aarch64-only use of SectionMemoryManager for
LLVM-21
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
LLVM-21 changed the invocation of RTDyldObjectLinkingLayer, breaking
compilation with the backported SectionMemoryManager for aarch64.
Introduce a version guard for the newly passed parameter.
Signed-off-by: Holger Hoffstätte <[email protected]>
---
src/backend/jit/llvm/llvmjit_wrap.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/backend/jit/llvm/llvmjit_wrap.cpp b/src/backend/jit/llvm/llvmjit_wrap.cpp
index da850d67ab6..d98e3d0d900 100644
--- a/src/backend/jit/llvm/llvmjit_wrap.cpp
+++ b/src/backend/jit/llvm/llvmjit_wrap.cpp
@@ -53,7 +53,14 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(llvm::orc::ObjectLayer, LLVMOrcObjectLayerRef
LLVMOrcObjectLayerRef
LLVMOrcCreateRTDyldObjectLinkingLayerWithSafeSectionMemoryManager(LLVMOrcExecutionSessionRef ES)
{
+#if LLVM_VERSION_MAJOR >= 21
+ return wrap(new llvm::orc::RTDyldObjectLinkingLayer(
+ *unwrap(ES), [](const llvm::MemoryBuffer &) {
+ return std::make_unique<llvm::backport::SectionMemoryManager>(nullptr, true);
+ }));
+#else
return wrap(new llvm::orc::RTDyldObjectLinkingLayer(
*unwrap(ES), [] { return std::make_unique<llvm::backport::SectionMemoryManager>(nullptr, true); }));
+#endif
}
#endif
--
2.51.0