Skip to content

Commit de96b43

Browse files
committed
Fix GH-16902: Set of opcache tests fail zts+aarch64 (8.2-8.3)
Closes GH-16925.
1 parent 99f5653 commit de96b43

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PHP NEWS
2929
(nielsdos, Dmitry)
3030
. Fixed bug GH-16851 (JIT_G(enabled) not set correctly on other threads).
3131
(dktapps)
32+
. Fixed bug GH-16902 (Set of opcache tests fail zts+aarch64). (nielsdos)
3233

3334
- OpenSSL:
3435
. Prevent unexpected array entry conversion when reading key. (nielsdos)

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 18 additions & 0 deletions
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)