aboutsummaryrefslogtreecommitdiff
path: root/lib/arm/sync_synchronize.S
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arm/sync_synchronize.S')
-rw-r--r--lib/arm/sync_synchronize.S34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/arm/sync_synchronize.S b/lib/arm/sync_synchronize.S
new file mode 100644
index 000000000000..76fdab1fbdb2
--- /dev/null
+++ b/lib/arm/sync_synchronize.S
@@ -0,0 +1,34 @@
+//===-- sync_synchronize - Implement memory barrier * ----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+//
+// When compiling a use of the gcc built-in __sync_synchronize() in thumb1 mode
+// the compiler may emit a call to __sync_synchronize.
+// On Darwin the implementation jumps to an OS supplied function named
+// OSMemoryBarrier
+//
+
+ .text
+ .syntax unified
+
+#if __APPLE__
+
+ .align 2
+DEFINE_COMPILERRT_PRIVATE_FUNCTION(__sync_synchronize)
+ stmfd sp!, {r7, lr}
+ add r7, sp, #0
+ bl _OSMemoryBarrier
+ ldmfd sp!, {r7, pc}
+
+ // tell linker it can break up file at label boundaries
+ .subsections_via_symbols
+
+#endif