Skip to content

Commit 6d5c8f1

Browse files
committed
Fix TLS access in JIT on FreeBSD x86-64
FreeBSD uses two headers fields in the DTV, so the module ID is offset by 1
1 parent b040ea8 commit 6d5c8f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,6 +3256,14 @@ static void zend_jit_setup(void)
32563256
: "=a" (ti));
32573257
tsrm_tls_offset = ti[1];
32583258
tsrm_tls_index = ti[0] * 8;
3259+
#elif defined(__FreeBSD__)
3260+
size_t *ti;
3261+
3262+
__asm__(
3263+
"leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
3264+
: "=a" (ti));
3265+
tsrm_tls_offset = ti[1];
3266+
tsrm_tls_index = (ti[0] + 1) * 8;
32593267
#else
32603268
size_t *ti;
32613269

0 commit comments

Comments
 (0)