[compiler-rt] r220203 - Fix checks for Android.

Dan Albert danalbert at google.com
Mon Oct 20 08:35:01 PDT 2014


Author: danalbert
Date: Mon Oct 20 10:35:01 2014
New Revision: 220203

URL: http://llvm.org/viewvc/llvm-project?rev=220203&view=rev
Log:
Fix checks for Android.

__ANDROID__ is a define that comes from the toolchain when building
for Android targets. ANDROID has a different meaning. ANDROID is
defined for _every_ Android build, including those done for host
modules. For host modules, we want to build the regular Linux
sanitizers and builtins, not the one for Android devices. This hasn't
been a problem until now because we only just started building the
sanitizers for the host.

Modified:
    compiler-rt/trunk/lib/asan/tests/asan_test.cc
    compiler-rt/trunk/lib/builtins/clear_cache.c
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
    compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h

Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=220203&r1=220202&r2=220203&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Mon Oct 20 10:35:01 2014
@@ -117,7 +117,7 @@ TEST(AddressSanitizer, CallocReturnsZero
 }
 
 // No valloc on Windows or Android.
-#if !defined(_WIN32) && !defined(ANDROID) && !defined(__ANDROID__)
+#if !defined(_WIN32) && !defined(__ANDROID__)
 TEST(AddressSanitizer, VallocTest) {
   void *a = valloc(100);
   EXPECT_EQ(0U, (uintptr_t)a % kPageSize);
@@ -769,7 +769,7 @@ char* MallocAndMemsetString(size_t size)
   return MallocAndMemsetString(size, 'z');
 }
 
-#if defined(__linux__) && !defined(ANDROID) && !defined(__ANDROID__)
+#if defined(__linux__) && !defined(__ANDROID__)
 #define READ_TEST(READ_N_BYTES)                                          \
   char *x = new char[10];                                                \
   int fd = open("/proc/self/stat", O_RDONLY);                            \
@@ -792,7 +792,7 @@ TEST(AddressSanitizer, pread64) {
 TEST(AddressSanitizer, read) {
   READ_TEST(read(fd, x, 15));
 }
-#endif  // defined(__linux__) && !defined(ANDROID) && !defined(__ANDROID__)
+#endif  // defined(__linux__) && !defined(__ANDROID__)
 
 // This test case fails
 // Clang optimizes memcpy/memset calls which lead to unaligned access
@@ -1153,7 +1153,7 @@ TEST(AddressSanitizer, AttributeNoSaniti
 //   https://code.google.com/p/address-sanitizer/issues/detail?id=131
 // Windows support is tracked here:
 //   https://code.google.com/p/address-sanitizer/issues/detail?id=309
-#if !defined(ANDROID) && !defined(__ANDROID__) && \
+#if !defined(__ANDROID__) && \
     !defined(__APPLE__) && \
     !defined(_WIN32)
 static string MismatchStr(const string &str) {

Modified: compiler-rt/trunk/lib/builtins/clear_cache.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/clear_cache.c?rev=220203&r1=220202&r2=220203&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/clear_cache.c (original)
+++ compiler-rt/trunk/lib/builtins/clear_cache.c Mon Oct 20 10:35:01 2014
@@ -17,11 +17,11 @@
   #include <machine/sysarch.h>
 #endif
 
-#if defined(ANDROID) && defined(__mips__)
+#if defined(__ANDROID__) && defined(__mips__)
   #include <sys/cachectl.h>
 #endif
 
-#if defined(ANDROID) && defined(__arm__)
+#if defined(__ANDROID__) && defined(__arm__)
   #include <asm/unistd.h>
 #endif
 
@@ -46,7 +46,7 @@ void __clear_cache(void *start, void *en
         arg.len = (uintptr_t)end - (uintptr_t)start;
 
         sysarch(ARM_SYNC_ICACHE, &arg);
-    #elif defined(ANDROID)
+    #elif defined(__ANDROID__)
          const register int start_reg __asm("r0") = (int) (intptr_t) start;
          const register int end_reg __asm("r1") = (int) (intptr_t) end;
          const register int flags __asm("r2") = 0;
@@ -59,7 +59,7 @@ void __clear_cache(void *start, void *en
     #else
         compilerrt_abort();
     #endif
-#elif defined(ANDROID) && defined(__mips__)
+#elif defined(__ANDROID__) && defined(__mips__)
   const uintptr_t start_int = (uintptr_t) start;
   const uintptr_t end_int = (uintptr_t) end;
   _flush_cache(start, (end_int - start_int), BCACHE);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h?rev=220203&r1=220202&r2=220203&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Mon Oct 20 10:35:01 2014
@@ -49,7 +49,7 @@
 # define SANITIZER_WINDOWS 0
 #endif
 
-#if defined(__ANDROID__) || defined(ANDROID)
+#if defined(__ANDROID__)
 # define SANITIZER_ANDROID 1
 #else
 # define SANITIZER_ANDROID 0

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h?rev=220203&r1=220202&r2=220203&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h Mon Oct 20 10:35:01 2014
@@ -95,13 +95,13 @@ static inline uint32_t my_rand() {
 
 // Set availability of platform-specific functions.
 
-#if !defined(__APPLE__) && !defined(ANDROID) && !defined(__ANDROID__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(__ANDROID__) && !defined(_WIN32)
 # define SANITIZER_TEST_HAS_POSIX_MEMALIGN 1
 #else
 # define SANITIZER_TEST_HAS_POSIX_MEMALIGN 0
 #endif
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(ANDROID) && \
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && \
     !defined(__ANDROID__) && !defined(_WIN32)
 # define SANITIZER_TEST_HAS_MEMALIGN 1
 # define SANITIZER_TEST_HAS_PVALLOC 1





More information about the llvm-commits mailing list