fix-macos26-qyield.patch raw
1 commit a76004f16fdc43e1b7af83bfdf3f1a613491b234
2 Author: Paul Wicking <paul.wicking@qt.io>
3 Date: Thu Mar 26 07:09:43 2026 +0100
4
5 qyieldcpu: Fix compilation with macOS 26.4 SDK
6
7 After updating to the macOS 26.4 SDK, qtbase fails to compile on
8 Apple Silicon with an implicit function declaration error for
9 __yield() in qyieldcpu.h. It appears that the SDK's Clang now
10 reports __has_builtin(__yield) as true, but __yield() requires
11 <arm_acle.h> for its declaration.
12
13 The compiler's own __builtin_arm_yield intrinsic was already checked
14 further down in the cascade. Moving it above the __yield check resolves
15 the build failure, without unnecessarily pulling in the header.
16
17 Fixes: QTBUG-145239
18 Change-Id: I94b4d8f72385a4944c272ed7a66d249537a82e7d
19 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
20 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
21
22 --- a/qtbase/src/corelib/thread/qyieldcpu.h
23 +++ b/qtbase/src/corelib/thread/qyieldcpu.h
24 @@ -31,7 +31,9 @@ void qYieldCpu(void)
25 noexcept
26 #endif
27 {
28 -#if __has_builtin(__yield)
29 +#if __has_builtin(__builtin_arm_yield)
30 + __builtin_arm_yield();
31 +#elif __has_builtin(__yield)
32 __yield(); // Generic
33 #elif defined(_YIELD_PROCESSOR) && defined(Q_CC_MSVC)
34 _YIELD_PROCESSOR(); // Generic; MSVC's <atomic>
35 @@ -45,9 +47,6 @@ void qYieldCpu(void)
36 _mm_pause();
37 #elif defined(Q_PROCESSOR_X86)
38 __asm__("pause"); // hopefully asm() works in this compiler
39 -
40 -#elif __has_builtin(__builtin_arm_yield)
41 - __builtin_arm_yield();
42 #elif defined(Q_PROCESSOR_ARM) && Q_PROCESSOR_ARM >= 7 && defined(Q_CC_GNU)
43 __asm__("yield"); // this works everywhere
44
45