pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Holger Hoffstätte <holger@applied-asynchrony.com>
To: pgsql-hackers@postgresql.org
Subject: [PATCH] jit: fix build with LLVM-21
Date: Mon, 8 Sep 2025 15:20:38 +0200
Message-ID: <d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d@applied-asynchrony.com> (raw)

(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

Attachments:

llvm21.patch (text/x-patch, 1.0K) download From 932b8f540f157ce9bcbae9ff618d507e9229778e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <holger@applied-asynchrony.com> 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

view thread (14+ messages)  latest in thread

Message-ID: <d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d@applied-asynchrony.com>
Permalink:  ../d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d@applied-asynchrony.com/
Also on:    postgresql.org/message-id/d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d@applied-asynchrony.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: holger@applied-asynchrony.com
  Subject: Re: [PATCH] jit: fix build with LLVM-21
  In-Reply-To: <d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d@applied-asynchrony.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox