summaryrefslogtreecommitdiffstats
path: root/lib/libcompiler_rt/__sync_fetch_and_op_n.h
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2013-04-27 04:56:02 +0000
committered <ed@FreeBSD.org>2013-04-27 04:56:02 +0000
commitf201fcc561ac7eab4ed7997403288e40b18a75a4 (patch)
tree4b862626af7bfbb06d0c17477809c39c52c3c91c /lib/libcompiler_rt/__sync_fetch_and_op_n.h
parent44c2a968f1f309c08b4f02d245f5af4afaf4fe76 (diff)
downloadFreeBSD-src-f201fcc561ac7eab4ed7997403288e40b18a75a4.zip
FreeBSD-src-f201fcc561ac7eab4ed7997403288e40b18a75a4.tar.gz
Unbreak <stdatomic.h> on ARM + Clang.
Clang only supports atomic operations for ARMv6. For non-ARMv6, we still need to emit these functions. Clang's prototype for these functions slightly differs, as it is truly based on GCC's documentation. It requires the use of signed types, but also requires varargs. Still, we are not allowed to simply implement this function directly. Cleverly work around this by implementing it under a different name and using __strong_reference().
Diffstat (limited to 'lib/libcompiler_rt/__sync_fetch_and_op_n.h')
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_op_n.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libcompiler_rt/__sync_fetch_and_op_n.h b/lib/libcompiler_rt/__sync_fetch_and_op_n.h
index f7f0e06..994e271 100644
--- a/lib/libcompiler_rt/__sync_fetch_and_op_n.h
+++ b/lib/libcompiler_rt/__sync_fetch_and_op_n.h
@@ -30,8 +30,13 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/atomic.h>
+#if defined __clang__
+static TYPE
+atomic_func(volatile TYPE *ptr, TYPE value, ...)
+#else
TYPE
NAME(volatile TYPE *ptr, TYPE value)
+#endif
{
TYPE t;
@@ -45,3 +50,7 @@ NAME(volatile TYPE *ptr, TYPE value)
return (t);
}
+
+#ifdef __clang__
+__strong_reference(atomic_func, NAME);
+#endif
OpenPOWER on IntegriCloud