Skip to content

Commit 2b2aeb9

Browse files
mvorisekcmb69
authored andcommitted
Fix GH-8160: ZTS support on Alpine is broken
We need to export `__MUSL__` so that phpize builds can see the proper macro, and also need to fix "_tsrm_ls_cache" usage for musl. Closes GH-8180.
1 parent 6c3816c commit 2b2aeb9

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PHP NEWS
66
. Fixed freeing of internal attribute arguments. (Bob)
77
. Fixed bug GH-8070 (memory leak of internal function attribute hash).
88
(Tim Düsterhus)
9+
. Fixed bug GH-8160 (ZTS support on Alpine is broken). (Michael Voříšek)
910

1011
- Intl:
1112
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)

TSRM/TSRM.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,13 +736,13 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
736736
#if defined(__APPLE__) && defined(__x86_64__)
737737
// TODO: Implement support for fast JIT ZTS code ???
738738
return 0;
739-
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
739+
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__)
740740
size_t ret;
741741

742742
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
743743
: "=r" (ret));
744744
return ret;
745-
#elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
745+
#elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__)
746746
size_t ret;
747747

748748
asm ("leal _tsrm_ls_cache@ntpoff,%0"

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ AC_MSG_CHECKING([whether we are using musl libc])
260260
if command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl
261261
then
262262
AC_MSG_RESULT(yes)
263-
CPPFLAGS="$CPPFLAGS -D__MUSL__"
263+
AC_DEFINE([__MUSL__], [1], [Define when using musl libc])
264264
else
265265
AC_MSG_RESULT(no)
266266
fi

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,7 +2974,7 @@ static int zend_jit_setup(void)
29742974
# elif defined(__GNUC__) && defined(__x86_64__)
29752975
tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
29762976
if (tsrm_ls_cache_tcb_offset == 0) {
2977-
#if defined(__has_attribute) && __has_attribute(tls_model) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
2977+
#if defined(__has_attribute) && __has_attribute(tls_model) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__)
29782978
size_t ret;
29792979

29802980
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
@@ -2993,7 +2993,7 @@ static int zend_jit_setup(void)
29932993
# elif defined(__GNUC__) && defined(__i386__)
29942994
tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
29952995
if (tsrm_ls_cache_tcb_offset == 0) {
2996-
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
2996+
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__)
29972997
size_t ret;
29982998

29992999
asm ("leal _tsrm_ls_cache@ntpoff,%0\n"

0 commit comments

Comments
 (0)