[llvm-commits] [compiler-rt] r162666 - in /compiler-rt/trunk/lib: asan/asan_internal.h asan/asan_linux.cc asan/asan_malloc_linux.cc asan/asan_mapping.h asan/asan_new_delete.cc asan/asan_thread_registry.cc sanitizer_common/sanitizer_symbolizer_linux.cc
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Mon Aug 27 04:15:55 PDT 2012
Author: eugenis
Date: Mon Aug 27 06:15:55 2012
New Revision: 162666
URL: http://llvm.org/viewvc/llvm-project?rev=162666&view=rev
Log:
A few tweaks for building ASanRT against Android NDK.
Modified:
compiler-rt/trunk/lib/asan/asan_internal.h
compiler-rt/trunk/lib/asan/asan_linux.cc
compiler-rt/trunk/lib/asan/asan_malloc_linux.cc
compiler-rt/trunk/lib/asan/asan_mapping.h
compiler-rt/trunk/lib/asan/asan_new_delete.cc
compiler-rt/trunk/lib/asan/asan_thread_registry.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Mon Aug 27 06:15:55 2012
@@ -48,6 +48,13 @@
# define ASAN_WINDOWS 0
#endif
+#if defined(__ANDROID__) || defined(ANDROID)
+# define ASAN_ANDROID 1
+#else
+# define ASAN_ANDROID 0
+#endif
+
+
#define ASAN_POSIX (ASAN_LINUX || ASAN_MAC)
#if __has_feature(address_sanitizer)
Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_linux.cc Mon Aug 27 06:15:55 2012
@@ -31,7 +31,7 @@
#include <unistd.h>
#include <unwind.h>
-#ifndef ANDROID
+#if !ASAN_ANDROID
// FIXME: where to get ucontext on Android?
#include <sys/ucontext.h>
#endif
@@ -50,7 +50,7 @@
}
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
-#ifdef ANDROID
+#if ASAN_ANDROID
*pc = *sp = *bp = 0;
#elif defined(__arm__)
ucontext_t *ucontext = (ucontext_t*)context;
Modified: compiler-rt/trunk/lib/asan/asan_malloc_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_linux.cc?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_malloc_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_malloc_linux.cc Mon Aug 27 06:15:55 2012
@@ -20,7 +20,7 @@
#include "asan_internal.h"
#include "asan_stack.h"
-#ifdef ANDROID
+#if ASAN_ANDROID
DECLARE_REAL_AND_INTERCEPTOR(void*, malloc, uptr size);
DECLARE_REAL_AND_INTERCEPTOR(void, free, void *ptr);
DECLARE_REAL_AND_INTERCEPTOR(void*, calloc, uptr nmemb, uptr size);
Modified: compiler-rt/trunk/lib/asan/asan_mapping.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mapping.h?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mapping.h (original)
+++ compiler-rt/trunk/lib/asan/asan_mapping.h Mon Aug 27 06:15:55 2012
@@ -25,7 +25,7 @@
# define SHADOW_SCALE (__asan_mapping_scale)
# define SHADOW_OFFSET (__asan_mapping_offset)
#else
-# ifdef ANDROID
+# if ASAN_ANDROID
# define SHADOW_SCALE (3)
# define SHADOW_OFFSET (0)
# else
Modified: compiler-rt/trunk/lib/asan/asan_new_delete.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_new_delete.cc?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_new_delete.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_new_delete.cc Mon Aug 27 06:15:55 2012
@@ -32,7 +32,7 @@
GET_STACK_TRACE_HERE_FOR_MALLOC;\
return asan_memalign(0, size, &stack);
-#ifdef ANDROID
+#if ASAN_ANDROID
void *operator new(size_t size) { OPERATOR_NEW_BODY; }
void *operator new[](size_t size) { OPERATOR_NEW_BODY; }
#else
Modified: compiler-rt/trunk/lib/asan/asan_thread_registry.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread_registry.cc?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread_registry.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread_registry.cc Mon Aug 27 06:15:55 2012
@@ -69,7 +69,7 @@
AsanThread *AsanThreadRegistry::GetCurrent() {
AsanThreadSummary *summary = (AsanThreadSummary *)AsanTSDGet();
if (!summary) {
-#ifdef ANDROID
+#if ASAN_ANDROID
// On Android, libc constructor is called _after_ asan_init, and cleans up
// TSD. Try to figure out if this is still the main thread by the stack
// address. We are not entirely sure that we have correct main thread
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc?rev=162666&r1=162665&r2=162666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc Mon Aug 27 06:15:55 2012
@@ -20,12 +20,15 @@
#include <elf.h>
#include <errno.h>
-#include <link.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
+#if !defined(__ANDROID__) && !defined(ANDROID)
+#include <link.h>
+#endif
+
namespace __sanitizer {
bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
@@ -99,7 +102,7 @@
return true;
}
-#ifdef ANDROID
+#if defined(__ANDROID__) || defined(ANDROID)
uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
UNIMPLEMENTED();
}
More information about the llvm-commits
mailing list