|
| 1 | +From d90c9e25a4dd22e126e848ff4fc56631268c7c1c Mon Sep 17 00:00:00 2001 |
| 2 | +From: Paul Wicking <paul.wicking@qt.io> |
| 3 | +Date: Thu, 26 Mar 2026 07:09:43 +0100 |
| 4 | +Subject: [PATCH] qyieldcpu: Fix compilation with macOS 26.4 SDK |
| 5 | +MIME-Version: 1.0 |
| 6 | +Content-Type: text/plain; charset=UTF-8 |
| 7 | +Content-Transfer-Encoding: 8bit |
| 8 | + |
| 9 | +After updating to the macOS 26.4 SDK, qtbase fails to compile on |
| 10 | +Apple Silicon with an implicit function declaration error for |
| 11 | +__yield() in qyieldcpu.h. It appears that the SDK's Clang now |
| 12 | +reports __has_builtin(__yield) as true, but __yield() requires |
| 13 | +<arm_acle.h> for its declaration. |
| 14 | + |
| 15 | +The compiler's own __builtin_arm_yield intrinsic was already checked |
| 16 | +further down in the cascade. Moving it above the __yield check resolves |
| 17 | +the build failure, without unnecessarily pulling in the header. |
| 18 | + |
| 19 | +Fixes: QTBUG-145239 |
| 20 | +Pick-to: 6.8 |
| 21 | +Change-Id: I94b4d8f72385a4944c272ed7a66d249537a82e7d |
| 22 | +Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> |
| 23 | +Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> |
| 24 | +(cherry picked from commit a76004f16fdc43e1b7af83bfdf3f1a613491b234) |
| 25 | +--- |
| 26 | + src/corelib/thread/qyieldcpu.h | 7 +++---- |
| 27 | + 1 file changed, 3 insertions(+), 4 deletions(-) |
| 28 | + |
| 29 | +diff --git a/src/corelib/thread/qyieldcpu.h b/src/corelib/thread/qyieldcpu.h |
| 30 | +index 66156487d66b..84093f42dbe7 100644 |
| 31 | +--- a/src/corelib/thread/qyieldcpu.h |
| 32 | ++++ b/src/corelib/thread/qyieldcpu.h |
| 33 | +@@ -33,7 +33,9 @@ void qYieldCpu(void) |
| 34 | + noexcept |
| 35 | + #endif |
| 36 | + { |
| 37 | +-#if __has_builtin(__yield) |
| 38 | ++#if __has_builtin(__builtin_arm_yield) |
| 39 | ++ __builtin_arm_yield(); |
| 40 | ++#elif __has_builtin(__yield) |
| 41 | + __yield(); // Generic |
| 42 | + #elif defined(_YIELD_PROCESSOR) && defined(Q_CC_MSVC) |
| 43 | + _YIELD_PROCESSOR(); // Generic; MSVC's <atomic> |
| 44 | +@@ -47,9 +49,6 @@ void qYieldCpu(void) |
| 45 | + _mm_pause(); |
| 46 | + #elif defined(Q_PROCESSOR_X86) |
| 47 | + __asm__("pause"); // hopefully asm() works in this compiler |
| 48 | +- |
| 49 | +-#elif __has_builtin(__builtin_arm_yield) |
| 50 | +- __builtin_arm_yield(); |
| 51 | + #elif defined(Q_PROCESSOR_ARM) && Q_PROCESSOR_ARM >= 7 && defined(Q_CC_GNU) |
| 52 | + __asm__("yield"); // this works everywhere |
| 53 | + |
0 commit comments