postgres.git / summary / log / commit / refs

commit    915711c8a4e60f606a8417ad033cea5385364c07
Author:   Thomas Munro <tmunro@postgresql.org>
Date:     Wed Dec 31 00:24:17 2025 +0000
First released in: 19.0, 14.21, 15.16, 16.12, 17.8, 18.2

    jit: Fix jit_profiling_support when unavailable.
    
    jit_profiling_support=true captures profile data for Linux perf.  On
    other platforms, LLVMCreatePerfJITEventListener() returns NULL and the
    attempt to register the listener would crash.
    
    Fix by ignoring the setting in that case.  The documentation already
    says that it only has an effect if perf support is present, and we
    already did the same for older LLVM versions that lacked support.
    
    No field reports, unsurprisingly for an obscure developer-oriented
    setting.  Noticed in passing while working on commit 1a28b4b4.
    
    Backpatch-through: 14
    Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
    Reviewed-by: Andres Freund <andres@anarazel.de>
    Discussion: https://postgr.es/m/CA%2BhUKGJgB6gvrdDohgwLfCwzVQm%3DVMtb9m0vzQn%3DCwWn-kwG9w%40mail.gmail.com


src/backend/jit/llvm/llvmjit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 9b599d11380..c6079330544 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -1191,7 +1191,8 @@ llvm_create_object_layer(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *T { LLVMJITEventListenerRef l = LLVMCreatePerfJITEventListener(); - LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(objlayer, l); + if (l) + LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(objlayer, l); } return objlayer; [parent: bc6374cd76ab]