From 0fab2593b436ef1aa87cb272297903a4e0189fd5 Mon Sep 17 00:00:00 2001
From: "yang.lee" <yang.lee@starfivetech.com>
Date: Thu, 26 May 2022 11:26:50 +0800
Subject: [PATCH 3/3] compiler-rt: Use mcr based barrier on armv6

dsb is an armv7 instruction and wont work when we are building for armv6.

Rebased By Lee Yang
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 compiler-rt/lib/builtins/assembly.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
index 69a3d8620f92..60bac86df218 100644
--- a/compiler-rt/lib/builtins/assembly.h
+++ b/compiler-rt/lib/builtins/assembly.h
@@ -189,6 +189,14 @@
   JMP(ip)
 #endif
 
+#if __ARM_ARCH >= 7
+#define DMB dmb
+#elif __ARM_ARCH >= 6
+#define DMB mcr p15, #0, r0, c7, c10, #5
+#else
+#error Only use this with ARMv6+
+#endif
+
 #if defined(USE_THUMB_2)
 #define WIDE(op) op.w
 #else
-- 
2.25.1

