File tree Expand file tree Collapse file tree 3 files changed +55
-10
lines changed
Expand file tree Collapse file tree 3 files changed +55
-10
lines changed Original file line number Diff line number Diff line change 1414 libmysqlclient_with_mysqli :
1515 required : true
1616 type : boolean
17+ macos_arm64_version :
18+ required : true
19+ type : string
1720 run_alpine :
1821 required : true
1922 type : boolean
@@ -366,11 +369,11 @@ jobs:
366369 matrix :
367370 debug : [true, false]
368371 zts : [true, false]
369- os : ['13 ', '14 ']
372+ arch : ['X64 ', 'ARM64 ']
370373 exclude :
371- - os : ${{ !inputs.run_macos_arm64 && '14 ' || '*never*' }}
372- name : " MACOS_${{ matrix.os == '13' && 'X64' || 'ARM64' }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
373- runs-on : macos-${{ matrix.os }}
374+ - arch : ${{ !inputs.run_macos_arm64 && 'ARM64 ' || '*never*' }}
375+ name : " MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
376+ runs-on : macos-${{ matrix.arch == 'X64' && '15-intel' || inputs.macos_arm64_version }}
374377 steps :
375378 - name : git checkout
376379 uses : actions/checkout@v5
@@ -393,7 +396,7 @@ jobs:
393396 - name : Test
394397 uses : ./.github/actions/test-macos
395398 - name : Test Tracing JIT
396- if : matrix.os != '14 ' || !matrix.zts
399+ if : matrix.arch == 'X64 ' || !matrix.zts
397400 uses : ./.github/actions/test-macos
398401 with :
399402 jitType : tracing
@@ -405,7 +408,7 @@ jobs:
405408 runTestsParameters : >-
406409 -d opcache.enable_cli=1
407410 - name : Test Function JIT
408- if : matrix.os != '14 ' || !matrix.zts
411+ if : matrix.arch == 'X64 ' || !matrix.zts
409412 uses : ./.github/actions/test-macos
410413 with :
411414 jitType : function
Original file line number Diff line number Diff line change 5252 branch : ${{ matrix.branch.ref }}
5353 community_verify_type_inference : ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
5454 libmysqlclient_with_mysqli : ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1) }}
55+ macos_arm64_version : ${{ ((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '15' || '14' }}
5556 run_alpine : ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
5657 run_linux_ppc64 : ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
5758 run_macos_arm64 : ${{ (matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9 }}
Original file line number Diff line number Diff line change 2323
2424#include <stdint.h>
2525#include <unistd.h>
26+ #include <mach-o/dyld.h>
2627
2728TSRMLS_CACHE_EXTERN ();
2829
30+ /* Thunk format used since dydl 1284 (approx. MacOS 15)
31+ * https://github.com/apple-oss-distributions/dyld/blob/9307719dd8dc9b385daa412b03cfceb897b2b398/libdyld/ThreadLocalVariables.h#L146 */
32+ #if defined(__x86_64__ ) || defined(__aarch64__ )
33+ struct TLV_Thunkv2
34+ {
35+ void * func ;
36+ uint32_t key ;
37+ uint32_t offset ;
38+ };
39+ #else
40+ struct TLV_Thunkv2
41+ {
42+ void * func ;
43+ uint16_t key ;
44+ uint16_t offset ;
45+ };
46+ #endif
47+
48+ /* Thunk format used in earlier versions */
49+ struct TLV_Thunkv1
50+ {
51+ void * func ;
52+ size_t key ;
53+ size_t offset ;
54+ };
55+
2956zend_result zend_jit_resolve_tsrm_ls_cache_offsets (
3057 size_t * tcb_offset ,
3158 size_t * module_index ,
@@ -37,12 +64,26 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
3764 }
3865
3966#if defined(__x86_64__ )
40- size_t * ti ;
67+ void * data ;
4168 __asm__ __volatile__(
4269 "leaq __tsrm_ls_cache(%%rip),%0"
43- : "=r" (ti ));
44- * module_offset = ti [2 ];
45- * module_index = ti [1 ] * 8 ;
70+ : "=r" (data ));
71+
72+ /* Detect dyld 1284: With dyld 1284, thunk->func will be _tlv_get_addr.
73+ * Unfortunately this symbol is private, but we can find it
74+ * as _tlv_bootstrap+8: https://github.com/apple-oss-distributions/dyld/blob/9307719dd8dc9b385daa412b03cfceb897b2b398/libdyld/threadLocalHelpers.s#L54
75+ * On earlier version, thunk->func will be tlv_get_addr, which is not
76+ * _tlv_bootstrap+8.
77+ */
78+ if (((struct TLV_Thunkv2 * )data )-> func == (void * )((char * )_tlv_bootstrap + 8 )) {
79+ struct TLV_Thunkv2 * thunk = (struct TLV_Thunkv2 * ) data ;
80+ * module_offset = thunk -> offset ;
81+ * module_index = (size_t )thunk -> key * 8 ;
82+ } else {
83+ struct TLV_Thunkv1 * thunk = (struct TLV_Thunkv1 * ) data ;
84+ * module_offset = thunk -> offset ;
85+ * module_index = thunk -> key * 8 ;
86+ }
4687
4788 return SUCCESS ;
4889#endif
You can’t perform that action at this time.
0 commit comments