From 6bb6eeaead0a80663504bbec7bbb1a32f08cfd92 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Mon, 21 Jun 2021 09:41:43 +1200 Subject: [PATCH] Adjust for LLVM 13 API change. LLVM 13 (not yet released, but due out in a few months) has changed the semantics of LLVMOrcAbsoluteSymbols(), so that we now need to bump a reference count on the symbol names we give it to avoid a double-free. Discussion: https://postgr.es/m/CA%2BhUKGLEy8mgtN7BNp0ooFAjUedDTJj5dME7NxLU-m91b85siA%40mail.gmail.com --- src/backend/jit/llvm/llvmjit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 71029a39a9..df691cbf1c 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -1106,6 +1106,9 @@ llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, { const char *name = LLVMOrcSymbolStringPoolEntryStr(LookupSet[i].Name); +#if LLVM_VERSION_MAJOR > 12 + LLVMOrcRetainSymbolStringPoolEntry(LookupSet[i].Name); +#endif symbols[i].Name = LookupSet[i].Name; symbols[i].Sym.Address = llvm_resolve_symbol(name, NULL); symbols[i].Sym.Flags.GenericFlags = LLVMJITSymbolGenericFlagsExported; -- 2.30.2