Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available for static Thread Local Storage)

This commit is contained in:
Dmitry Stogov 2021-03-10 16:03:47 +03:00
parent 7931956805
commit 3b377b51a2
4 changed files with 7 additions and 5 deletions

2
NEWS
View file

@ -6,6 +6,8 @@ PHP NEWS
. Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb) . Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb)
. Fixed bug #80811 (Function exec without $output but with $restult_code . Fixed bug #80811 (Function exec without $output but with $restult_code
parameter crashes). (Nikita) parameter crashes). (Nikita)
. Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space
available for static Thread Local Storage). (Dmitry)
- IMAP: - IMAP:
. Fixed bug #80800 (imap_open() fails when the flags parameter includes . Fixed bug #80800 (imap_open() fails when the flags parameter includes

View file

@ -729,13 +729,13 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
#if defined(__APPLE__) && defined(__x86_64__) #if defined(__APPLE__) && defined(__x86_64__)
// TODO: Implement support for fast JIT ZTS code ??? // TODO: Implement support for fast JIT ZTS code ???
return 0; return 0;
#elif defined(__x86_64__) && defined(__GNUC__) #elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__)
size_t ret; size_t ret;
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0" asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
: "=r" (ret)); : "=r" (ret));
return ret; return ret;
#elif defined(__i386__) && defined(__GNUC__) #elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__)
size_t ret; size_t ret;
asm ("leal _tsrm_ls_cache@ntpoff,%0" asm ("leal _tsrm_ls_cache@ntpoff,%0"

View file

@ -147,7 +147,7 @@ TSRM_API const char *tsrm_api_name(void);
# define __has_attribute(x) 0 # define __has_attribute(x) 0
#endif #endif
#if !__has_attribute(tls_model) #if !__has_attribute(tls_model) || defined(__FreeBSD__)
# define TSRM_TLS_MODEL_ATTR # define TSRM_TLS_MODEL_ATTR
#elif __PIC__ #elif __PIC__
# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec"))) # define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec")))

View file

@ -2933,7 +2933,7 @@ static int zend_jit_setup(void)
# elif defined(__GNUC__) && defined(__x86_64__) # elif defined(__GNUC__) && defined(__x86_64__)
tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset(); tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
if (tsrm_ls_cache_tcb_offset == 0) { if (tsrm_ls_cache_tcb_offset == 0) {
#if defined(__has_attribute) && __has_attribute(tls_model) #if defined(__has_attribute) && __has_attribute(tls_model) && !defined(__FreeBSD__)
size_t ret; size_t ret;
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0" asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
@ -2952,7 +2952,7 @@ static int zend_jit_setup(void)
# elif defined(__GNUC__) && defined(__i386__) # elif defined(__GNUC__) && defined(__i386__)
tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset(); tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
if (tsrm_ls_cache_tcb_offset == 0) { if (tsrm_ls_cache_tcb_offset == 0) {
#if 1 #if !defined(__FreeBSD__)
size_t ret; size_t ret;
asm ("leal _tsrm_ls_cache@ntpoff,%0\n" asm ("leal _tsrm_ls_cache@ntpoff,%0\n"