From 5559036b62d800d1d4efb4cc2b12d891919cbc5c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 5 Feb 2024 15:36:02 +0300 Subject: [PATCH] Fix TLS access in JIT with MUSL --- ext/opcache/jit/zend_jit_x86.dasc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 6d92a32d570e6..d1cbbd6391c53 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -2901,6 +2901,14 @@ static int zend_jit_setup(void) asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0" : "=r" (ret)); tsrm_ls_cache_tcb_offset = ret; +#elif defined(__MUSL__) + size_t *ti; + + __asm__( + "leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n" + : "=a" (ti)); + tsrm_tls_offset = ti[1]; + tsrm_tls_index = ti[0] * 8; #else size_t *ti;