Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uw5wU-005wqi-FB for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Sep 2025 21:31:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uw5wS-00EuAc-Mc for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Sep 2025 21:31:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uvbnX-004e77-5O for pgsql-hackers@lists.postgresql.org; Mon, 08 Sep 2025 13:20:43 +0000 Received: from mail.itouring.de ([2a01:4f8:a0:4463::2]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uvbnU-001Cqd-0O for pgsql-hackers@postgresql.org; Mon, 08 Sep 2025 13:20:43 +0000 Received: from tux.applied-asynchrony.com (p5b347a18.dip0.t-ipconnect.de [91.52.122.24]) by mail.itouring.de (Postfix) with ESMTPSA id 470061F86 for ; Mon, 08 Sep 2025 15:20:39 +0200 (CEST) Received: from [192.168.100.221] (hho.applied-asynchrony.com [192.168.100.221]) by tux.applied-asynchrony.com (Postfix) with ESMTP id AA64A60187F25 for ; Mon, 08 Sep 2025 15:20:38 +0200 (CEST) To: pgsql-hackers@postgresql.org From: =?UTF-8?Q?Holger_Hoffst=c3=a4tte?= Subject: [PATCH] jit: fix build with LLVM-21 Organization: Applied Asynchrony, Inc. Message-ID: Date: Mon, 8 Sep 2025 15:20:38 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------EB5D7FB875FF112F95AD5343" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------EB5D7FB875FF112F95AD5343 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit (please cc: me on replies) Hello! I tried building against LLVM-21 and noticed that a function for symbol lookup was renamed (without semantic changes), breaking the LLVM JIT. The following patch fixes this by adding a version guard. It applies equally to both master and 17.6. Passes the test suite and verified on 17.6 with the jit example from the documentation. cheers, Holger --------------EB5D7FB875FF112F95AD5343 Content-Type: text/x-patch; charset=UTF-8; name="llvm21.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="llvm21.patch" From 932b8f540f157ce9bcbae9ff618d507e9229778e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= Date: Mon, 8 Sep 2025 14:57:32 +0200 Subject: [PATCH] jit: fix build with LLVM-21 LLVM-21 renamed llvm::GlobalValue::getGUID() to getGUIDAssumingExternalLinkage(), so add a version guard. --- src/backend/jit/llvm/llvmjit_inline.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp b/src/backend/jit/llvm/llvmjit_inline.cpp index 2764c3bbe2f..39a19ec6a46 100644 --- a/src/backend/jit/llvm/llvmjit_inline.cpp +++ b/src/backend/jit/llvm/llvmjit_inline.cpp @@ -238,7 +238,11 @@ llvm_build_inline_plan(LLVMContextRef lc, llvm::Module *mod) llvm_split_symbol_name(symbolName.data(), &cmodname, &cfuncname); +#if LLVM_VERSION_MAJOR < 21 funcGUID = llvm::GlobalValue::getGUID(cfuncname); +#else + funcGUID = llvm::GlobalValue::getGUIDAssumingExternalLinkage(cfuncname); +#endif /* already processed */ if (inlineState.processed) -- 2.51.0 --------------EB5D7FB875FF112F95AD5343--