[llvm-commits] [compiler-rt] r170114 - in /compiler-rt/trunk/lib: asan/asan_intercepted_functions.h sanitizer_common/sanitizer_common_interceptors.h

Alexey Samsonov samsonov at google.com
Thu Dec 13 00:36:13 PST 2012


Author: samsonov
Date: Thu Dec 13 02:36:13 2012
New Revision: 170114

URL: http://llvm.org/viewvc/llvm-project?rev=170114&view=rev
Log:
[ASan] one more macro for 'read' interception

Modified:
    compiler-rt/trunk/lib/asan/asan_intercepted_functions.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h

Modified: compiler-rt/trunk/lib/asan/asan_intercepted_functions.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_intercepted_functions.h?rev=170114&r1=170113&r2=170114&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_intercepted_functions.h (original)
+++ compiler-rt/trunk/lib/asan/asan_intercepted_functions.h Thu Dec 13 02:36:13 2012
@@ -154,7 +154,9 @@
 # endif
 
 // unistd.h
+# if SANITIZER_INTERCEPT_READ
 DECLARE_FUNCTION_AND_WRAPPER(SSIZE_T, read, int fd, void *buf, SIZE_T count);
+# endif
 # if SANITIZER_INTERCEPT_PREAD
 DECLARE_FUNCTION_AND_WRAPPER(SSIZE_T, pread, int fd, void *buf,
                              SIZE_T count, OFF_T offset);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h?rev=170114&r1=170113&r2=170114&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.h Thu Dec 13 02:36:13 2012
@@ -23,8 +23,10 @@
 #include "interception/interception.h"
 
 #if !defined(_WIN32)
+# define SANITIZER_INTERCEPT_READ 1
 # define SANITIZER_INTERCEPT_PREAD 1
 #else
+# define SANITIZER_INTERCEPT_READ 0
 # define SANITIZER_INTERCEPT_PREAD 0
 #endif
 
@@ -34,6 +36,7 @@
 # define SANITIZER_INTERCEPT_PREAD64 0
 #endif
 
+#if SANITIZER_INTERCEPT_READ
 INTERCEPTOR(SSIZE_T, read, int fd, void *ptr, SIZE_T count) {
   COMMON_INTERCEPTOR_ENTER(read, fd, ptr, count);
   SSIZE_T res = REAL(read)(fd, ptr, count);
@@ -41,6 +44,7 @@
     COMMON_INTERCEPTOR_WRITE_RANGE(ptr, res);
   return res;
 }
+#endif
 
 #if SANITIZER_INTERCEPT_PREAD
 INTERCEPTOR(SSIZE_T, pread, int fd, void *ptr, SIZE_T count, OFF_T offset) {
@@ -62,6 +66,12 @@
 }
 #endif
 
+#if SANITIZER_INTERCEPT_READ
+# define INIT_READ CHECK(INTERCEPT_FUNCTION(read))
+#else
+# define INIT_READ
+#endif
+
 #if SANITIZER_INTERCEPT_PREAD
 # define INIT_PREAD CHECK(INTERCEPT_FUNCTION(pread))
 #else
@@ -75,7 +85,7 @@
 #endif
 
 #define SANITIZER_COMMON_INTERCEPTORS_INIT \
-  CHECK(INTERCEPT_FUNCTION(read));         \
+  INIT_READ;                               \
   INIT_PREAD;                              \
   INIT_PREAD64;                            \
 





More information about the llvm-commits mailing list