mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix JIT TLS on MacOS
This commit is contained in:
2
NEWS
2
NEWS
@@ -15,6 +15,8 @@ PHP NEWS
|
|||||||
- Opcache:
|
- Opcache:
|
||||||
. Fixed bug GH-20081 (access to uninitialized vars in preload_load()).
|
. Fixed bug GH-20081 (access to uninitialized vars in preload_load()).
|
||||||
(Arnaud)
|
(Arnaud)
|
||||||
|
. Fixed bug GH-20121 (JIT broken in ZTS builds on MacOS 15).
|
||||||
|
(Arnaud, Shivam Mathur)
|
||||||
|
|
||||||
- SPL:
|
- SPL:
|
||||||
. Fixed bug GH-20101 (SplHeap/SplPriorityQueue serialization
|
. Fixed bug GH-20101 (SplHeap/SplPriorityQueue serialization
|
||||||
|
|||||||
@@ -23,9 +23,36 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
|
||||||
TSRMLS_CACHE_EXTERN();
|
TSRMLS_CACHE_EXTERN();
|
||||||
|
|
||||||
|
/* Thunk format used since dydl 1284 (approx. MacOS 15)
|
||||||
|
* https://github.com/apple-oss-distributions/dyld/blob/9307719dd8dc9b385daa412b03cfceb897b2b398/libdyld/ThreadLocalVariables.h#L146 */
|
||||||
|
#if defined(__x86_64__) || defined(__aarch64__)
|
||||||
|
struct TLV_Thunkv2
|
||||||
|
{
|
||||||
|
void* func;
|
||||||
|
uint32_t key;
|
||||||
|
uint32_t offset;
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
struct TLV_Thunkv2
|
||||||
|
{
|
||||||
|
void* func;
|
||||||
|
uint16_t key;
|
||||||
|
uint16_t offset;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Thunk format used in earlier versions */
|
||||||
|
struct TLV_Thunkv1
|
||||||
|
{
|
||||||
|
void* func;
|
||||||
|
size_t key;
|
||||||
|
size_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
|
zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
|
||||||
size_t *tcb_offset,
|
size_t *tcb_offset,
|
||||||
size_t *module_index,
|
size_t *module_index,
|
||||||
@@ -37,12 +64,25 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
size_t *ti;
|
struct TLV_Thunkv2 *thunk;
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"leaq __tsrm_ls_cache(%%rip),%0"
|
"leaq __tsrm_ls_cache(%%rip),%0"
|
||||||
: "=r" (ti));
|
: "=r" (thunk));
|
||||||
*module_offset = ti[2];
|
|
||||||
*module_index = ti[1] * 8;
|
/* Detect dyld 1284: With dyld 1284, thunk->func will be _tlv_get_addr.
|
||||||
|
* Unfortunately this symbol is private, but we can find it
|
||||||
|
* as _tlv_bootstrap+8: https://github.com/apple-oss-distributions/dyld/blob/9307719dd8dc9b385daa412b03cfceb897b2b398/libdyld/threadLocalHelpers.s#L54
|
||||||
|
* In earlier versions, thunk->func will be tlv_get_addr, which is not
|
||||||
|
* _tlv_bootstrap+8.
|
||||||
|
*/
|
||||||
|
if (thunk->func == (void*)((char*)_tlv_bootstrap + 8)) {
|
||||||
|
*module_offset = thunk->offset;
|
||||||
|
*module_index = (size_t)thunk->key * 8;
|
||||||
|
} else {
|
||||||
|
struct TLV_Thunkv1 *thunkv1 = (struct TLV_Thunkv1*) thunk;
|
||||||
|
*module_offset = thunkv1->offset;
|
||||||
|
*module_index = thunkv1->key * 8;
|
||||||
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user