diff options
| author | Alexey Samsonov <samsonov@google.com> | 2012-06-05 13:50:57 +0000 |
|---|---|---|
| committer | Alexey Samsonov <samsonov@google.com> | 2012-06-05 13:50:57 +0000 |
| commit | ef2e2cfd3325fb9bbd696bc928322f96cb8b1971 (patch) | |
| tree | 0041a68ac8ac08da78c8841bab2da7f8bbb05f28 /compiler-rt/lib/tsan/rtl | |
| parent | 03cd639b5695769aa4976018a187c50378c71a04 (diff) | |
| download | bcm5719-llvm-ef2e2cfd3325fb9bbd696bc928322f96cb8b1971.tar.gz bcm5719-llvm-ef2e2cfd3325fb9bbd696bc928322f96cb8b1971.zip | |
[Sanitizer] Use common defines for ASan and TSan runtime. Split defines between interface defines (can be visible in user code that includes interface ASan/TSan headers) and internal defines.
llvm-svn: 157998
Diffstat (limited to 'compiler-rt/lib/tsan/rtl')
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_allocator.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_compiler.h | 30 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_defs.h | 13 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_placement_new.h | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl.cc | 4 |
8 files changed, 12 insertions, 45 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_allocator.cc b/compiler-rt/lib/tsan/rtl/tsan_allocator.cc index 28cc2b3f537..1571b47089e 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_allocator.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_allocator.cc @@ -13,7 +13,7 @@ #include "tsan_allocator.h" // Provisional implementation. -extern "C" void *__libc_malloc(__tsan::uptr size); +extern "C" void *__libc_malloc(__sanitizer::uptr size); extern "C" void __libc_free(void *ptr); namespace __tsan { diff --git a/compiler-rt/lib/tsan/rtl/tsan_compiler.h b/compiler-rt/lib/tsan/rtl/tsan_compiler.h deleted file mode 100644 index 6aab097d427..00000000000 --- a/compiler-rt/lib/tsan/rtl/tsan_compiler.h +++ /dev/null @@ -1,30 +0,0 @@ -//===-- tsan_rtl.h ----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is a part of ThreadSanitizer (TSan), a race detector. -// -// Compiler-specific definitions. -//===----------------------------------------------------------------------===// - -#ifndef TSAN_COMPILER_H -#define TSAN_COMPILER_H - -#define INLINE static inline -#define NOINLINE __attribute__((noinline)) -#define ALWAYS_INLINE __attribute__((always_inline)) -#define NORETURN __attribute__((noreturn)) -#define WEAK __attribute__((weak)) -#define ALIGN(n) __attribute__((aligned(n))) -#define LIKELY(x) __builtin_expect(!!(x), 1) -#define UNLIKELY(x) __builtin_expect(!!(x), 0) -#define THREADLOCAL __thread -#define FORMAT(f, a) __attribute__((format(printf, f, a))) -#define USED __attribute__((used)) - -#endif // TSAN_COMPILER_H diff --git a/compiler-rt/lib/tsan/rtl/tsan_defs.h b/compiler-rt/lib/tsan/rtl/tsan_defs.h index 608b58e3459..c25cb8176ab 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_defs.h +++ b/compiler-rt/lib/tsan/rtl/tsan_defs.h @@ -14,19 +14,16 @@ #ifndef TSAN_DEFS_H #define TSAN_DEFS_H -#include "tsan_compiler.h" +#include "sanitizer_common/sanitizer_defs.h" #include "tsan_stat.h" #ifndef TSAN_DEBUG #define TSAN_DEBUG 0 #endif // TSAN_DEBUG -namespace __tsan { +using namespace __sanitizer; -typedef unsigned u32; // NOLINT -typedef unsigned long long u64; // NOLINT -typedef signed long long s64; // NOLINT -typedef unsigned long uptr; // NOLINT +namespace __tsan { const uptr kPageSize = 4096; const int kTidBits = 13; @@ -60,8 +57,8 @@ const bool kCollectStats = false; #define CHECK_IMPL(c1, op, c2) \ do { \ - __tsan::u64 v1 = (u64)(c1); \ - __tsan::u64 v2 = (u64)(c2); \ + __sanitizer::u64 v1 = (u64)(c1); \ + __sanitizer::u64 v2 = (u64)(c2); \ if (!(v1 op v2)) \ __tsan::CheckFailed(__FILE__, __LINE__, \ "(" #c1 ") " #op " (" #c2 ")", v1, v2); \ diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index 83bfa2c3f9e..3cc6f14d9af 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -126,7 +126,7 @@ class ScopedInterceptor { StatInc(thr, StatInterceptor); \ StatInc(thr, StatInt_##func); \ ScopedInterceptor si(thr, #func, \ - (__tsan::uptr)__builtin_return_address(0)); \ + (__sanitizer::uptr)__builtin_return_address(0)); \ const uptr pc = (uptr)&func; \ (void)pc; \ /**/ diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc b/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc index b5c8f996831..58be599ad16 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc @@ -84,7 +84,7 @@ struct DynamicAnnContext { }; static DynamicAnnContext *dyn_ann_ctx; -static char dyn_ann_ctx_placeholder[sizeof(DynamicAnnContext)] ALIGN(64); +static char dyn_ann_ctx_placeholder[sizeof(DynamicAnnContext)] ALIGNED(64); static void AddExpectRace(ExpectRace *list, char *f, int l, uptr addr, uptr size, char *desc) { diff --git a/compiler-rt/lib/tsan/rtl/tsan_placement_new.h b/compiler-rt/lib/tsan/rtl/tsan_placement_new.h index 7b8ba036e82..e506b172e8b 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_placement_new.h +++ b/compiler-rt/lib/tsan/rtl/tsan_placement_new.h @@ -17,7 +17,7 @@ #include "tsan_defs.h" -inline void *operator new(__tsan::uptr sz, void *p) { +inline void *operator new(__sanitizer::uptr sz, void *p) { return p; } diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc index 0525478ebf4..8f8f982440a 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc @@ -39,7 +39,7 @@ using namespace __sanitizer; // NOLINT -extern "C" int arch_prctl(int code, __tsan::uptr *addr); +extern "C" int arch_prctl(int code, __sanitizer::uptr *addr); namespace __tsan { diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc index 4b805048226..c9ebcf7dd0e 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc @@ -31,8 +31,8 @@ extern "C" void __tsan_resume() { namespace __tsan { using namespace __sanitizer; -THREADLOCAL char cur_thread_placeholder[sizeof(ThreadState)] ALIGN(64); -static char ctx_placeholder[sizeof(Context)] ALIGN(64); +THREADLOCAL char cur_thread_placeholder[sizeof(ThreadState)] ALIGNED(64); +static char ctx_placeholder[sizeof(Context)] ALIGNED(64); static Context *ctx; Context *CTX() { |

