From 91478930711c99c876f0df9475c056445eea96b6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 8 Dec 2023 17:15:51 -0800 Subject: [PATCH] qYieldCpu: ensure we don't use asm statement with MSVC on ARM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends a7f227f56cfe562280e89d3c73040f7e8384129e. It doesn't support that anywhere except i386, and even there it has a different syntax than what we're using here. This code assumed ARM was only ued with GCC-like compilers. qglobal.c.obj : error LNK2019: unresolved external symbol asm referenced in function tst_qYieldCpu tests\auto\corelib\global\qglobal\tst_qglobal.exe : fatal error LNK1120: 1 unresolved externals Note: if we're getting here, it means the _YIELD_PROCESSOR() generic macro was not used, which means there is no ARM YIELD being emitted for MSVC on ARM for C code (for C++, the macro appears to be working). This is likely to be a performance issue, which will need to be fixed by someone who has an interest in improving performance on those conditions. Fixes: QTBUG-119881 Pick-to: 6.7 Change-Id: Ica7a43f6147b49c187ccfffd179f04e1ab643302 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Marc Mutz --- src/corelib/thread/qyieldcpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qyieldcpu.h b/src/corelib/thread/qyieldcpu.h index b54e54568d..db39b2f9e5 100644 --- a/src/corelib/thread/qyieldcpu.h +++ b/src/corelib/thread/qyieldcpu.h @@ -48,7 +48,7 @@ void qYieldCpu(void) #elif __has_builtin(__builtin_arm_yield) __builtin_arm_yield(); -#elif defined(Q_PROCESSOR_ARM) && Q_PROCESSOR_ARM >= 7 +#elif defined(Q_PROCESSOR_ARM) && Q_PROCESSOR_ARM >= 7 && defined(Q_CC_GNU) asm("yield"); // this works everywhere #elif __has_builtin(__builtin_riscv_pause)