8000 Prepare for forthcoming LLVM 13 API change. · postgrespro/postgres@6ada4fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ada4fd

Browse files
committed
Prepare for forthcoming LLVM 13 API change.
LLVM 13 (due out in September) has changed the semantics of LLVMOrcAbsoluteSymbols(), so we need to bump some reference counts to avoid a double-free that causes crashes and bad query results. A proactive change seems necessary to avoid having a window of time where our respective latest releases would interact badly. It's possible that the situation could change before then, though. Thanks to Fabien Coelho for monitoring bleeding edge LLVM and Andres Freund for tracking down the change. Back-patch to 11, where the JIT code arrived. Discussion: https://postgr.es/m/CA%2BhUKGLEy8mgtN7BNp0ooFAjUedDTJj5dME7NxLU-m91b85siA%40mail.gmail.com
1 parent 0efd2a1 commit 6ada4fd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/jit/llvm/llvmjit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,9 @@ llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx,
11041104
{
11051105
const char *name = LLVMOrcSymbolStringPoolEntryStr(LookupSet[i].Name);
11061106

1107+
#if LLVM_VERSION_MAJOR > 12
1108+
LLVMOrcRetainSymbolStringPoolEntry(LookupSet[i].Name);
1109+
#endif
11071110
symbols[i].Name = LookupSet[i].Name;
11081111
symbols[i].Sym.Address = llvm_resolve_symbol(name, NULL);
11091112
symbols[i].Sym.Flags.GenericFlags = LLVMJITSymbolGenericFlagsExported;

0 commit comments

Comments
 (0)
0