Skip to content

Commit 7ef9b47

Browse files
committed
Fix jit
1 parent cd74a77 commit 7ef9b47

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

ext/opcache/jit/tls/zend_jit_tls_darwin.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626

2727
TSRMLS_CACHE_EXTERN();
2828

29+
struct TLSDescriptor {
30+
void *(*thunk)(struct TLSDescriptor *);
31+
uintptr_t key;
32+
uintptr_t offset;
33+
};
34+
2935
zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
3036
size_t *tcb_offset,
3137
size_t *module_index,
@@ -37,17 +43,22 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
3743
}
3844

3945
#if defined(__x86_64__)
40-
size_t *ti;
46+
const struct TLSDescriptor *desc;
4147
__asm__ __volatile__(
42-
"leaq __tsrm_ls_cache(%%rip),%0"
43-
: "=r" (ti));
44-
*module_offset = ti[2];
45-
*module_index = ti[1] * 8;
48+
"leaq __tsrm_ls_cache@TLVP(%%rip), %0\n"
49+
"movq (%0), %0"
50+
: "=&r" (desc)
51+
:
52+
: "memory"
53+
);
4654

47-
return SUCCESS;
48-
#endif
55+
*module_index = (size_t)desc->key;
56+
*module_offset = (size_t)desc->offset;
4957

58+
return SUCCESS;
59+
#else
5060
return FAILURE;
61+
#endif
5162
}
5263

5364
/* Used for testing */

0 commit comments

Comments
 (0)