[compiler-rt] r183524 - [ASan] An early return from InitializeAsanInterceptors() on Mac has been considered unobvious.

Alexander Potapenko glider at google.com
Fri Jun 7 08:10:02 PDT 2013


Author: glider
Date: Fri Jun  7 10:10:02 2013
New Revision: 183524

URL: http://llvm.org/viewvc/llvm-project?rev=183524&view=rev
Log:
[ASan] An early return from InitializeAsanInterceptors() on Mac has been considered unobvious.
Remove it and replace ASAN_INTERCEPT_FUNC with a no-op if SANITIZER_MAC==1.

Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.cc

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=183524&r1=183523&r2=183524&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Fri Jun  7 10:10:02 2013
@@ -657,10 +657,15 @@ INTERCEPTOR(int, __cxa_atexit, void (*fu
 }
 #endif  // ASAN_INTERCEPT___CXA_ATEXIT
 
+#if !SANITIZER_MAC
 #define ASAN_INTERCEPT_FUNC(name) do { \
       if (!INTERCEPT_FUNCTION(name) && flags()->verbosity > 0) \
         Report("AddressSanitizer: failed to intercept '" #name "'\n"); \
     } while (0)
+#else
+// OS X interceptors don't need to be initialized with INTERCEPT_FUNCTION.
+#define ASAN_INTERCEPT_FUNC(name)
+#endif  // SANITIZER_MAC
 
 #if SANITIZER_WINDOWS
 INTERCEPTOR_WINAPI(DWORD, CreateThread,
@@ -693,9 +698,6 @@ void InitializeAsanInterceptors() {
   static bool was_called_once;
   CHECK(was_called_once == false);
   was_called_once = true;
-#if SANITIZER_MAC
-  return;
-#else
   SANITIZER_COMMON_INTERCEPTORS_INIT;
 
   // Intercept mem* functions.
@@ -780,7 +782,6 @@ void InitializeAsanInterceptors() {
   if (flags()->verbosity > 0) {
     Report("AddressSanitizer: libc interceptors initialized\n");
   }
-#endif  // SANITIZER_MAC
 }
 
 }  // namespace __asan





More information about the llvm-commits mailing list