Skip to content

Commit 32284e1

Browse files
committed
Fix GH-16902: Set of opcache tests fail zts+aarch64 (8.2-8.3)
1 parent ff3b4ec commit 32284e1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

+18
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,11 @@ static bool logical_immediate_p(uint64_t value, uint32_t reg_size)
504504
||#else
505505
| .long 0xd53bd051 // TODO: hard-coded: mrs TMP3, tpidr_el0
506506
|| if (tsrm_ls_cache_tcb_offset == 0) {
507+
||#ifdef __MUSL__
508+
| ldr TMP3, [TMP3, #-8]
509+
||#else
507510
| ldr TMP3, [TMP3, #0]
511+
||#endif
508512
| MEM_ACCESS_64_WITH_UOFFSET_64 ldr, TMP3, TMP3, tsrm_tls_index, TMP1
509513
| MEM_ACCESS_64_WITH_UOFFSET_64 ldr, reg, TMP3, tsrm_tls_offset, TMP1
510514
|| } else {
@@ -2790,6 +2794,20 @@ static int zend_jit_setup(void)
27902794
/* Index is offset by 1 on FreeBSD (https://github.com/freebsd/freebsd-src/blob/22ca6db50f4e6bd75a141f57cf953d8de6531a06/lib/libc/gen/tls.c#L88) */
27912795
tsrm_tls_index = (tlsdesc->index + 1) * 8;
27922796
}
2797+
# elif defined(__MUSL__)
2798+
if (tsrm_ls_cache_tcb_offset == 0) {
2799+
size_t **where;
2800+
2801+
__asm__(
2802+
"adrp %0, :tlsdesc:_tsrm_ls_cache\n"
2803+
"add %0, %0, :tlsdesc_lo12:_tsrm_ls_cache\n"
2804+
: "=r" (where));
2805+
/* See https://github.com/ARM-software/abi-aa/blob/2a70c42d62e9c3eb5887fa50b71257f20daca6f9/aaelf64/aaelf64.rst */
2806+
size_t *tlsdesc = where[1];
2807+
2808+
tsrm_tls_offset = tlsdesc[1];
2809+
tsrm_tls_index = tlsdesc[0] * 8;
2810+
}
27932811
# else
27942812
ZEND_ASSERT(tsrm_ls_cache_tcb_offset != 0);
27952813
# endif

0 commit comments

Comments
 (0)