[compiler-rt] r219395 - [Tsan] Fix references to libc entities in tsan_interceptors.cc on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Thu Oct 9 01:56:22 PDT 2014


Author: vkutuzov
Date: Thu Oct  9 03:56:22 2014
New Revision: 219395

URL: http://llvm.org/viewvc/llvm-project?rev=219395&view=rev
Log:
[Tsan] Fix references to libc entities in tsan_interceptors.cc on FreeBSD
Differential Revision: http://reviews.llvm.org/D5663

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=219395&r1=219394&r2=219395&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Thu Oct  9 03:56:22 2014
@@ -29,6 +29,16 @@
 
 using namespace __tsan;  // NOLINT
 
+#if SANITIZER_FREEBSD
+#define __errno_location __error
+#define __libc_malloc __malloc
+#define __libc_realloc __realloc
+#define __libc_calloc __calloc
+#define __libc_free __free
+#define stdout __stdoutp
+#define stderr __stderrp
+#endif
+
 const int kSigCount = 65;
 
 struct my_siginfo_t {
@@ -62,7 +72,9 @@ extern "C" void *__libc_malloc(uptr size
 extern "C" void *__libc_calloc(uptr size, uptr n);
 extern "C" void *__libc_realloc(void *ptr, uptr size);
 extern "C" void __libc_free(void *ptr);
+#if !SANITIZER_FREEBSD
 extern "C" int mallopt(int param, int value);
+#endif
 extern __sanitizer_FILE *stdout, *stderr;
 const int PTHREAD_MUTEX_RECURSIVE = 1;
 const int PTHREAD_MUTEX_RECURSIVE_NP = 1;
@@ -2252,8 +2264,10 @@ void InitializeInterceptors() {
   REAL(memcmp) = internal_memcmp;
 
   // Instruct libc malloc to consume less memory.
+#if !SANITIZER_FREEBSD
   mallopt(1, 0);  // M_MXFAST
   mallopt(-3, 32*1024);  // M_MMAP_THRESHOLD
+#endif
 
   InitializeCommonInterceptors();
 





More information about the llvm-commits mailing list