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

Lines changed: 11 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy