50 lines
2.0 KiB
Diff
50 lines
2.0 KiB
Diff
|
From d69db2ba3ce47f6eded0a8843c413a67d26e6375 Mon Sep 17 00:00:00 2001
|
||
|
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||
|
Date: Sun, 24 Jul 2022 20:37:51 +0200
|
||
|
Subject: [PATCH] src/corelib/global/qsimd_p.h: fix build on ARM < v7 due to
|
||
|
yield instruction
|
||
|
|
||
|
On ARM < v7 with gcc, the build fails with:
|
||
|
|
||
|
/tmp/ccRlrCQi.s: Assembler messages:
|
||
|
/tmp/ccRlrCQi.s:3858: Error: selected processor does not support `yield' in ARM mode
|
||
|
/tmp/ccRlrCQi.s:3875: Error: selected processor does not support `yield' in ARM mode
|
||
|
/tmp/ccRlrCQi.s:4606: Error: selected processor does not support `yield' in ARM mode
|
||
|
/tmp/ccRlrCQi.s:4853: Error: selected processor does not support `yield' in ARM mode
|
||
|
/tmp/ccRlrCQi.s:5268: Error: selected processor does not support `yield' in ARM mode
|
||
|
|
||
|
while building src/corelib/thread/qfutureinterface.cpp.
|
||
|
|
||
|
This is due to the fact that the qYieldCpu() macro on ARM, assumes
|
||
|
that if the compiler is gcc, we can do asm volatile("yield"). However,
|
||
|
this instruction is only guaranteed to exist on ARMv7+ cores. It
|
||
|
doesn't exist on ARMv5, and only some (but not all) ARMv6 cores have
|
||
|
it. If it's not available, we just fallback to the default behavior of
|
||
|
qYieldCpu(), which is to do nothing.
|
||
|
|
||
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||
|
Upstream bug: https://bugreports.qt.io/browse/QTBUG-105162
|
||
|
---
|
||
|
src/corelib/global/qsimd_p.h | 5 ++++-
|
||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/corelib/global/qsimd_p.h b/src/corelib/global/qsimd_p.h
|
||
|
index d270d09f2f..b84b257e54 100644
|
||
|
--- a/src/corelib/global/qsimd_p.h
|
||
|
+++ b/src/corelib/global/qsimd_p.h
|
||
|
@@ -428,7 +428,10 @@ static inline void qYieldCpu()
|
||
|
https://stackoverflow.com/a/70076751/134841
|
||
|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105416
|
||
|
*/
|
||
|
- asm volatile("yield"); /* this works everywhere */
|
||
|
+# if defined(Q_PROCESSOR_ARM_V7)
|
||
|
+ /* The yield instruction appeared in ARMv7 */
|
||
|
+ asm volatile("yield");
|
||
|
+# endif
|
||
|
# else
|
||
|
__yield(); /* this is what should work everywhere */
|
||
|
# endif
|
||
|
--
|
||
|
2.37.1
|
||
|
|