Skip to content

Commit cc6d952

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix TLS access in JIT on FreeBSD/amd64
2 parents 7c5d655 + 5e895dd commit cc6d952

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,6 +3260,15 @@ static void zend_jit_setup(void)
32603260
: "=a" (ti));
32613261
tsrm_tls_offset = ti[1];
32623262
tsrm_tls_index = ti[0] * 8;
3263+
#elif defined(__FreeBSD__)
3264+
size_t *ti;
3265+
3266+
__asm__(
3267+
"leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
3268+
: "=a" (ti));
3269+
tsrm_tls_offset = ti[1];
3270+
/* Index is offset by 1 on FreeBSD (https://github.com/freebsd/freebsd-src/blob/bf56e8b9c8639ac4447d223b83cdc128107cc3cd/libexec/rtld-elf/rtld.c#L5260) */
3271+
tsrm_tls_index = (ti[0] + 1) * 8;
32633272
#else
32643273
size_t *ti;
32653274

0 commit comments

Comments
 (0)