Skip to content

Commit 512c04e

Browse files
Fix macOS CI (#24409)
* Run brew update in macOS CI * Drop intel macOS from CI * Fix build on Apple Clang 17+ (#18629) Fixing "invalid cpu feature string for builtin" errors that started to appear on Apple Clang 17.0.0 (cherry picked from commit 772479e) * Cleanup macOS job in test-suite.yml --------- Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
1 parent 810f0c6 commit 512c04e

4 files changed

Lines changed: 36 additions & 7 deletions

File tree

‎.github/actions/brew/action.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ runs:
66
run: |
77
set -x
88
9+
brew update
10+
911
# Patch brew to overwrite always
1012
formula_installer="$(brew --repo)"/Library/Homebrew/formula_installer.rb
1113
code=" keg.link\(verbose: verbose\?"

‎.github/matrix.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re
125125
: ['debug' => [true], 'zts' => [true]];
126126
}
127127
if ($all_jobs || !$no_jobs || $test_macos) {
128-
$test_arm = version_compare($php_version, '8.4', '>=');
129128
$jobs['MACOS']['matrix'] = $all_variations
130-
? ['arch' => $test_arm ? ['X64', 'ARM64'] : ['X64'], 'debug' => [true, false], 'zts' => [true, false]]
131-
: ['include' => [['arch' => $test_arm ? 'ARM64' : 'X64', 'debug' => true, 'zts' => false]]];
129+
? ['arch' => ['ARM64'], 'debug' => [true, false], 'zts' => [true, false]]
130+
: ['include' => [['arch' => 'ARM64', 'debug' => true, 'zts' => false]]];
132131
$jobs['MACOS']['config']['version'] = version_compare($php_version, '8.4', '>=') ? '26' : '15';
133132
}
134133
if ($all_jobs || $test_msan) {

‎.github/workflows/test-suite.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ jobs:
312312
fail-fast: false
313313
matrix: ${{ fromJson(inputs.branch).jobs.MACOS.matrix }}
314314
name: "MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
315-
runs-on: macos-${{ fromJson(inputs.branch).jobs.MACOS.config.version }}${{ matrix.arch == 'X64' && '-intel' || '' }}
315+
runs-on: macos-${{ fromJson(inputs.branch).jobs.MACOS.config.version }}
316316
timeout-minutes: 180
317317
steps:
318318
- name: git checkout
@@ -345,18 +345,18 @@ jobs:
345345
if: ${{ inputs.all_variations }}
346346
uses: ./.github/actions/test-macos
347347
- name: Test Tracing JIT
348-
if: ${{ matrix.arch == 'X64' || !matrix.zts }}
348+
if: ${{ !matrix.zts }}
349349
uses: ./.github/actions/test-macos
350350
with:
351351
enableOpcache: true
352352
jitType: tracing
353353
- name: Test OpCache
354-
if: ${{ inputs.all_variations || (matrix.arch == 'ARM64' && matrix.zts) }}
354+
if: ${{ inputs.all_variations || matrix.zts }}
355355
uses: ./.github/actions/test-macos
356356
with:
357357
enableOpcache: true
358358
- name: Test Function JIT
359-
if: ${{ inputs.all_variations && (matrix.arch == 'X64' || !matrix.zts) }}
359+
if: ${{ inputs.all_variations && !matrix.zts }}
360360
uses: ./.github/actions/test-macos
361361
with:
362362
enableOpcache: true

‎Zend/zend_cpuinfo.h‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,58 +121,86 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
121121
* functions */
122122
ZEND_NO_SANITIZE_ADDRESS
123123
static inline int zend_cpu_supports_sse2(void) {
124+
#ifdef __aarch64__
125+
return 0;
126+
#else
124127
#if PHP_HAVE_BUILTIN_CPU_INIT
125128
__builtin_cpu_init();
126129
#endif
127130
return __builtin_cpu_supports("sse2");
131+
#endif
128132
}
129133

130134
ZEND_NO_SANITIZE_ADDRESS
131135
static inline int zend_cpu_supports_sse3(void) {
136+
#ifdef __aarch64__
137+
return 0;
138+
#else
132139
#if PHP_HAVE_BUILTIN_CPU_INIT
133140
__builtin_cpu_init();
134141
#endif
135142
return __builtin_cpu_supports("sse3");
143+
#endif
136144
}
137145

138146
ZEND_NO_SANITIZE_ADDRESS
139147
static inline int zend_cpu_supports_ssse3(void) {
148+
#ifdef __aarch64__
149+
return 0;
150+
#else
140151
#if PHP_HAVE_BUILTIN_CPU_INIT
141152
__builtin_cpu_init();
142153
#endif
143154
return __builtin_cpu_supports("ssse3");
155+
#endif
144156
}
145157

146158
ZEND_NO_SANITIZE_ADDRESS
147159
static inline int zend_cpu_supports_sse41(void) {
160+
#ifdef __aarch64__
161+
return 0;
162+
#else
148163
#if PHP_HAVE_BUILTIN_CPU_INIT
149164
__builtin_cpu_init();
150165
#endif
151166
return __builtin_cpu_supports("sse4.1");
167+
#endif
152168
}
153169

154170
ZEND_NO_SANITIZE_ADDRESS
155171
static inline int zend_cpu_supports_sse42(void) {
172+
#ifdef __aarch64__
173+
return 0;
174+
#else
156175
#if PHP_HAVE_BUILTIN_CPU_INIT
157176
__builtin_cpu_init();
158177
#endif
159178
return __builtin_cpu_supports("sse4.2");
179+
#endif
160180
}
161181

162182
ZEND_NO_SANITIZE_ADDRESS
163183
static inline int zend_cpu_supports_avx(void) {
184+
#ifdef __aarch64__
185+
return 0;
186+
#else
164187
#if PHP_HAVE_BUILTIN_CPU_INIT
165188
__builtin_cpu_init();
166189
#endif
167190
return __builtin_cpu_supports("avx");
191+
#endif
168192
}
169193

170194
ZEND_NO_SANITIZE_ADDRESS
171195
static inline int zend_cpu_supports_avx2(void) {
196+
#ifdef __aarch64__
197+
return 0;
198+
#else
172199
#if PHP_HAVE_BUILTIN_CPU_INIT
173200
__builtin_cpu_init();
174201
#endif
175202
return __builtin_cpu_supports("avx2");
203+
#endif
176204
}
177205
#else
178206

0 commit comments

Comments
 (0)