summaryrefslogtreecommitdiff
path: root/lib/arm
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2010-02-02 21:34:04 +0000
committerNick Kledzik <kledzik@apple.com>2010-02-02 21:34:04 +0000
commit8ed16511fc83c535281b9770e2d17c1feb4f7bf5 (patch)
tree8e45d0d0fdfbbd7b41461c1d96570d8fc2161551 /lib/arm
parent182800c03b0e14da4a9afd94cda44bf606fcda5f (diff)
downloadcompiler-rt-8ed16511fc83c535281b9770e2d17c1feb4f7bf5.tar.gz
add __sync_synchronize. Needed by compiler when emitting thumb1 with -fno-builtin
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@95132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/arm')
-rw-r--r--lib/arm/sync_synchronize.S33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/arm/sync_synchronize.S b/lib/arm/sync_synchronize.S
new file mode 100644
index 000000000..40b584e10
--- /dev/null
+++ b/lib/arm/sync_synchronize.S
@@ -0,0 +1,33 @@
+//===-- 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__
+
+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