0001-src-corelib-global-qsimd_p.h-fix-build-on-ARM-v7-due.patch 2.0 KB

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