[llvm-commits] [compiler-rt] r158050 - in /compiler-rt/trunk/lib: sanitizer_common/sanitizer_common.h sanitizer_common/sanitizer_libc.h tsan/rtl/tsan_platform_linux.cc tsan/rtl/tsan_rtl.h
Alexey Samsonov
samsonov at google.com
Tue Jun 5 23:47:26 PDT 2012
Author: samsonov
Date: Wed Jun 6 01:47:26 2012
New Revision: 158050
URL: http://llvm.org/viewvc/llvm-project?rev=158050&view=rev
Log:
[Sanitizer] add sanitizer_common.h for routines shared between TSan and ASan runtimes. Use __sanitizer::Die() in TSan.
Added:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
Added: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=158050&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (added)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Wed Jun 6 01:47:26 2012
@@ -0,0 +1,28 @@
+//===-- sanitizer_common.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 shared between AddressSanitizer and ThreadSanitizer
+// run-time libraries.
+// It defines common functions and classes that are used in both runtimes.
+// Implementation of some functions are provided in sanitizer_common, while
+// others must be defined by run-time library itself.
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_COMMON_H
+#define SANITIZER_COMMON_H
+
+#include "sanitizer_internal_defs.h"
+
+namespace __sanitizer {
+
+// NOTE: Functions below must be defined in each run-time.
+void NORETURN Die();
+
+} // namespace __sanitizer
+
+#endif // SANITIZER_COMMON_H
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=158050&r1=158049&r2=158050&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Wed Jun 6 01:47:26 2012
@@ -11,16 +11,12 @@
// run-time libraries.
// These tools can not use some of the libc functions directly because those
// functions are intercepted. Instead, we implement a tiny subset of libc here.
-//
-// We also define several basic types here to avoid using system headers
-// as the latter complicate portability of this low-level code.
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_LIBC_H
#define SANITIZER_LIBC_H
#include "sanitizer_internal_defs.h"
-// No code here yet. Will move more code in the next changes.
namespace __sanitizer {
void MiniLibcStub();
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=158050&r1=158049&r2=158050&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Wed Jun 6 01:47:26 2012
@@ -39,6 +39,14 @@
extern "C" int arch_prctl(int code, __sanitizer::uptr *addr);
+namespace __sanitizer {
+
+void Die() {
+ _exit(1);
+}
+
+} // namespace __sanitizer
+
namespace __tsan {
static uptr g_tls_size;
@@ -56,10 +64,6 @@
CHECK_EQ(in_rtl_, thr_->in_rtl);
}
-void Die() {
- _exit(1);
-}
-
uptr GetShadowMemoryConsumption() {
return 0;
}
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=158050&r1=158049&r2=158050&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Wed Jun 6 01:47:26 2012
@@ -26,6 +26,7 @@
#ifndef TSAN_RTL_H
#define TSAN_RTL_H
+#include "sanitizer_common/sanitizer_common.h"
#include "tsan_clock.h"
#include "tsan_defs.h"
#include "tsan_flags.h"
@@ -390,7 +391,6 @@
void InitializeShadowMemory();
void InitializeInterceptors();
void InitializeDynamicAnnotations();
-void Die() NORETURN;
void ReportRace(ThreadState *thr);
bool OutputReport(const ScopedReport &srep,
More information about the llvm-commits
mailing list