about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-no-yield.patch
blob: 2fd48eda65185437df608544f7f9396975402589 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From ff0b373b959165477f45d9f5f9a8da471ae111ab Mon Sep 17 00:00:00 2001
From: Ben Wolsieffer <benwolsieffer@gmail.com>
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