[compiler-rt] 1c94158 - [compiler-rt][builtins] Move DMB definition to syn-ops.h

Pengxuan Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 14:57:59 PDT 2022


Author: Pengxuan Zheng
Date: 2022-04-07T14:57:41-07:00
New Revision: 1c9415806ba6d0d48a160637eea7d1b70efaae69

URL: https://github.com/llvm/llvm-project/commit/1c9415806ba6d0d48a160637eea7d1b70efaae69
DIFF: https://github.com/llvm/llvm-project/commit/1c9415806ba6d0d48a160637eea7d1b70efaae69.diff

LOG: [compiler-rt][builtins] Move DMB definition to syn-ops.h

Compiler-rt cross-compile for ARMv5 fails because D99282 made it an error if DMB
is used for any pre-ARMv6 targets. More specifically, the "#error only supported
on ARMv6+" added in D99282 will cause compilation to fail when any source file
which includes assembly.h are compiled for pre-ARMv6 targets. Since the only
place where DMB is used is syn-ops.h (which is only included by
arm/sync_fetch_and_* and these files are excluded from being built for older
targets), this patch moves the definition there to avoid the issues described
above.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D123105

Added: 
    

Modified: 
    compiler-rt/lib/builtins/arm/sync-ops.h
    compiler-rt/lib/builtins/assembly.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h
index d914f9d3a1093..dca201d8aef79 100644
--- a/compiler-rt/lib/builtins/arm/sync-ops.h
+++ b/compiler-rt/lib/builtins/arm/sync-ops.h
@@ -14,6 +14,14 @@
 
 #include "../assembly.h"
 
+#if __ARM_ARCH >= 7
+#define DMB dmb
+#elif __ARM_ARCH >= 6
+#define DMB mcr p15, #0, r0, c7, c10, #5
+#else
+#error DMB is only supported on ARMv6+
+#endif
+
 #define SYNC_OP_4(op)                                                          \
   .p2align 2;                                                                  \
   .syntax unified;                                                             \

diff  --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
index 06aa18162e3b4..69a3d8620f924 100644
--- a/compiler-rt/lib/builtins/assembly.h
+++ b/compiler-rt/lib/builtins/assembly.h
@@ -189,14 +189,6 @@
   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 supported on ARMv6+
-#endif
-
 #if defined(USE_THUMB_2)
 #define WIDE(op) op.w
 #else


        


More information about the llvm-commits mailing list