From ff0b373b959165477f45d9f5f9a8da471ae111ab Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Wed, 7 Dec 2022 18:03:56 -0500 Subject: [PATCH] [scudo][standalone] Only use yield on ARMv6K and newer The yield instruction is only available in ARMv6K and newer. It behaves as a nop on single threaded platforms anyway, so use nop instead on unsupported architectures. Differential Revision: https://reviews.llvm.org/D139600 --- compiler-rt/lib/scudo/standalone/common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/scudo/standalone/common.h b/lib/scudo/standalone/common.h index bc3dfec6dbba..862cda1d4bc4 100644 --- a/lib/scudo/standalone/common.h +++ b/lib/scudo/standalone/common.h @@ -109,7 +109,12 @@ inline void yieldProcessor(u8 Count) { #elif defined(__aarch64__) || defined(__arm__) __asm__ __volatile__("" ::: "memory"); for (u8 I = 0; I < Count; I++) +#if __ARM_ARCH >= 6 && !defined(__ARM_ARCH_6__) + // yield is supported on ARMv6K and newer __asm__ __volatile__("yield"); +#else + __asm__ __volatile__("nop"); +#endif #endif __asm__ __volatile__("" ::: "memory"); } -- 2.38.1