Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0207d5f

Browse files
committed
jit: Don't inline functions that access thread-locals.
Code inlined by LLVM can crash or fail with "Relocation type not implemented yet!" if it tries to access thread local variables. Don't inline such code. Back-patch to 11, where LLVM arrived. Bug #16696. Author: Dmitry Marakasov <amdmi3@amdmi3.ru> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/16696-29d944a33801fbfe@postgresql.org
1 parent 91e9e89 commit 0207d5f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/backend/jit/llvm/llvmjit_inline.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,17 @@ function_inlinable(llvm::Function &F,
608608
if (rv->materialize())
609609
elog(FATAL, "failed to materialize metadata");
610610

611+
/*
612+
* Don't inline functions that access thread local variables. That
613+
* doesn't work on current LLVM releases (but might in future).
614+
*/
615+
if (rv->isThreadLocal())
616+
{
617+
ilog(DEBUG1, "cannot inline %s due to thread-local variable %s",
618+
F.getName().data(), rv->getName().data());
619+
return false;
620+
}
621+
611622
/*
612623
* Never want to inline externally visible vars, cheap enough to
613624
* reference.

0 commit comments

Comments
 (0)