aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2013-09-27 13:33:10 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2013-10-01 16:41:41 +0800
commitc880feaaa8829681a025d29a33704c18e21e87e1 (patch)
treee455ba909f4dd5018e978f14347527bda96830c1
parent066cd5e4615399f4a70b9abaea699f1b62f394b5 (diff)
downloadcompiler-rt-release_33.tar.gz
Misc fixes for compiler_rtrelease_33
1. Exclude lib/atomic-arm.c when building compiler_rt with clang. The file is to implement intrinsics generated by gcc 2. Exclude lib/atomic.c when building compiler_rt with gcc which has different sets of atomic intrinsics 3. Expand() logbl() as logb() because logbl doesn't exist in Android until API18, and "long double" is the same as "double" Change-Id: I59921910a48f77e2e5f5da584a95cc64e6facf3f
-rw-r--r--lib/atomic-arm.c3
-rw-r--r--lib/atomic.c4
-rw-r--r--lib/int_math.h6
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/atomic-arm.c b/lib/atomic-arm.c
index 13d3b539d..648734477 100644
--- a/lib/atomic-arm.c
+++ b/lib/atomic-arm.c
@@ -289,6 +289,7 @@ int32_t android_atomic_nand_and_fetch (volatile int32_t *ptr, int32_t val)
}
#endif
+#if !defined(__clang__)
// gcc compatible interface
// http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/_005f_005fsync-Builtins.html
@@ -446,4 +447,6 @@ DEFINE_UNSUPPORT_SYNC_FUNC(val_compare_and_swap, int8_t, 1)
DEFINE_UNSUPPORT_SYNC_FUNC(val_compare_and_swap, int32_t, 2)
DEFINE_UNSUPPORT_SYNC_FUNC(val_compare_and_swap, int64_t, 8)
+#endif // __clang__
+
#endif // __arm__
diff --git a/lib/atomic.c b/lib/atomic.c
index a291f0d05..832dc81d8 100644
--- a/lib/atomic.c
+++ b/lib/atomic.c
@@ -25,6 +25,8 @@
*===----------------------------------------------------------------------===
*/
+#if defined(__clang__)
+
#include <stdint.h>
#include <string.h>
@@ -313,3 +315,5 @@ OPTIMISED_CASES
#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, xor, ^)
OPTIMISED_CASES
#undef OPTIMISED_CASE
+
+#endif // __clang__
diff --git a/lib/int_math.h b/lib/int_math.h
index d6b4bdae1..adc0dc5c6 100644
--- a/lib/int_math.h
+++ b/lib/int_math.h
@@ -58,7 +58,13 @@
#define crt_logb(x) __builtin_logb((x))
#define crt_logbf(x) __builtin_logbf((x))
+#if defined(__ANDROID__)
+// In Android "long double" carries distinct signature but is treated the
+// same as double, and logbl doesn't exist until API 18
+#define crt_logbl(x) __builtin_logb((double)(x))
+#else
#define crt_logbl(x) __builtin_logbl((x))
+#endif
#define crt_scalbn(x, y) __builtin_scalbn((x), (y))
#define crt_scalbnf(x, y) __builtin_scalbnf((x), (y))