[llvm-commits] [compiler-rt] r149492 - /compiler-rt/trunk/lib/asan/asan_interceptors.cc
Alexander Potapenko
glider at google.com
Wed Feb 1 02:07:52 PST 2012
Author: glider
Date: Wed Feb 1 04:07:52 2012
New Revision: 149492
URL: http://llvm.org/viewvc/llvm-project?rev=149492&view=rev
Log:
Disable wrapping memcpy() on Mac OS Lion, where it
actually falls back to memmove.
In this case we still need to initialize real_memcpy, so we set it to
real_memmove
We check for MACOS_VERSION_SNOW_LEOPARD, because currently only Snow
Leopard and Lion are supported.
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=149492&r1=149491&r2=149492&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Wed Feb 1 04:07:52 2012
@@ -676,8 +676,22 @@
OVERRIDE_FUNCTION(index, WRAP(strchr));
#endif
INTERCEPT_FUNCTION(memcmp);
- INTERCEPT_FUNCTION(memcpy);
INTERCEPT_FUNCTION(memmove);
+#ifdef __APPLE__
+ // Wrap memcpy() on OS X 10.6 only, because on 10.7 memcpy() and memmove()
+ // are resolved into memmove$VARIANT$sse42.
+ // See also http://code.google.com/p/address-sanitizer/issues/detail?id=34.
+ // TODO(glider): need to check dynamically that memcpy() and memmove() are
+ // actually the same function.
+ if (GetMacosVersion() == MACOS_VERSION_SNOW_LEOPARD) {
+ INTERCEPT_FUNCTION(memcpy);
+ } else {
+ real_memcpy = real_memmove;
+ }
+#else
+ // Always wrap memcpy() on non-Darwin platforms.
+ INTERCEPT_FUNCTION(memcpy);
+#endif
INTERCEPT_FUNCTION(memset);
INTERCEPT_FUNCTION(strcasecmp);
INTERCEPT_FUNCTION(strcat); // NOLINT
More information about the llvm-commits
mailing list