|
Jakub Jelinek |
6e9276 |
--- valgrind/memcheck/mc_replace_strmem.c.jj 2011-06-08 17:26:29.000000000 +0200
|
|
Jakub Jelinek |
6e9276 |
+++ valgrind/memcheck/mc_replace_strmem.c 2011-06-09 14:49:11.000000000 +0200
|
|
Jakub Jelinek |
6e9276 |
@@ -558,11 +558,7 @@ MEMCHR(VG_Z_DYLD, memchr)
|
|
Jakub Jelinek |
6e9276 |
#endif
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
-#define MEMCPY(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
- ( void *dst, const void *src, SizeT len ); \
|
|
Jakub Jelinek |
6e9276 |
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
- ( void *dst, const void *src, SizeT len ) \
|
|
Jakub Jelinek |
6e9276 |
+#define MEMCPY_BODY \
|
|
Jakub Jelinek |
6e9276 |
{ \
|
|
Jakub Jelinek |
6e9276 |
if (is_overlap(dst, src, len, len)) \
|
|
Jakub Jelinek |
6e9276 |
RECORD_OVERLAP_ERROR("memcpy", dst, src, len); \
|
|
Jakub Jelinek |
6e9276 |
@@ -628,6 +624,18 @@ MEMCHR(VG_Z_DYLD, memchr)
|
|
Jakub Jelinek |
6e9276 |
\
|
|
Jakub Jelinek |
6e9276 |
return dst; \
|
|
Jakub Jelinek |
6e9276 |
}
|
|
Jakub Jelinek |
6e9276 |
+#define MEMCPY(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ ( void *dst, const void *src, SizeT len ); \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ ( void *dst, const void *src, SizeT len ) \
|
|
Jakub Jelinek |
6e9276 |
+ MEMCPY_BODY
|
|
Jakub Jelinek |
6e9276 |
+#define MEMCPY_ZZ(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ ( void *dst, const void *src, SizeT len ); \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ ( void *dst, const void *src, SizeT len ) \
|
|
Jakub Jelinek |
6e9276 |
+ MEMCPY_BODY
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
MEMCPY(VG_Z_LIBC_SONAME, memcpy)
|
|
Jakub Jelinek |
6e9276 |
#if defined(VGO_linux)
|
|
Jakub Jelinek |
6e9276 |
@@ -636,6 +644,11 @@ MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64
|
|
Jakub Jelinek |
6e9276 |
#elif defined(VGO_darwin)
|
|
Jakub Jelinek |
6e9276 |
MEMCPY(VG_Z_DYLD, memcpy)
|
|
Jakub Jelinek |
6e9276 |
#endif
|
|
Jakub Jelinek |
6e9276 |
+#if defined(VGP_amd64_linux)
|
|
Jakub Jelinek |
6e9276 |
+/* In glibc 2.14+, memcpy@GLIBC_2.2.5 is an alias to memmove and only
|
|
Jakub Jelinek |
6e9276 |
+ memcpy@@GLIBC_2.14 is a real memcpy. */
|
|
Jakub Jelinek |
6e9276 |
+MEMCPY_ZZ(VG_Z_LIBC_SONAME, memcpyZAZAGLIBCZu2Zd14) /* memcpy@@GLIBC_2.14 */
|
|
Jakub Jelinek |
6e9276 |
+#endif
|
|
Jakub Jelinek |
6e9276 |
/* icc9 blats these around all over the place. Not only in the main
|
|
Jakub Jelinek |
6e9276 |
executable but various .so's. They are highly tuned and read
|
|
Jakub Jelinek |
6e9276 |
memory beyond the source boundary (although work correctly and
|
|
Jakub Jelinek |
6e9276 |
@@ -738,11 +751,7 @@ MEMSET(VG_Z_DYLD, memset)
|
|
Jakub Jelinek |
6e9276 |
#endif
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
-#define MEMMOVE(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
- (void *dstV, const void *srcV, SizeT n); \
|
|
Jakub Jelinek |
6e9276 |
- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
- (void *dstV, const void *srcV, SizeT n) \
|
|
Jakub Jelinek |
6e9276 |
+#define MEMMOVE_BODY \
|
|
Jakub Jelinek |
6e9276 |
{ \
|
|
Jakub Jelinek |
6e9276 |
SizeT i; \
|
|
Jakub Jelinek |
6e9276 |
Char* dst = (Char*)dstV; \
|
|
Jakub Jelinek |
6e9276 |
@@ -758,12 +767,31 @@ MEMSET(VG_Z_DYLD, memset)
|
|
Jakub Jelinek |
6e9276 |
} \
|
|
Jakub Jelinek |
6e9276 |
return dst; \
|
|
Jakub Jelinek |
6e9276 |
}
|
|
Jakub Jelinek |
6e9276 |
+#define MEMMOVE(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ (void *dstV, const void *srcV, SizeT n); \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ (void *dstV, const void *srcV, SizeT n) \
|
|
Jakub Jelinek |
6e9276 |
+ MEMMOVE_BODY
|
|
Jakub Jelinek |
6e9276 |
+#define MEMMOVE_ZZ(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ (void *dstV, const void *srcV, SizeT n); \
|
|
Jakub Jelinek |
6e9276 |
+ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \
|
|
Jakub Jelinek |
6e9276 |
+ (void *dstV, const void *srcV, SizeT n) \
|
|
Jakub Jelinek |
6e9276 |
+ MEMMOVE_BODY
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
MEMMOVE(VG_Z_LIBC_SONAME, memmove)
|
|
Jakub Jelinek |
6e9276 |
#if defined(VGO_darwin)
|
|
Jakub Jelinek |
6e9276 |
MEMMOVE(VG_Z_DYLD, memmove)
|
|
Jakub Jelinek |
6e9276 |
#endif
|
|
Jakub Jelinek |
6e9276 |
-
|
|
Jakub Jelinek |
6e9276 |
+#if defined(VGP_amd64_linux)
|
|
Jakub Jelinek |
6e9276 |
+/* In glibc 2.14+, memcpy@GLIBC_2.2.5 is an alias to memmove and only
|
|
Jakub Jelinek |
6e9276 |
+ memcpy@@GLIBC_2.14 is a real memcpy. It would be nice for
|
|
Jakub Jelinek |
6e9276 |
+ memcpy@GLIBC_2.2.5 to differentiate based on whether the caller
|
|
Jakub Jelinek |
6e9276 |
+ was calling memmove or memcpy@GLIBC_2.2.5, for now just treat
|
|
Jakub Jelinek |
6e9276 |
+ all such calls as memmove. */
|
|
Jakub Jelinek |
6e9276 |
+MEMMOVE_ZZ(VG_Z_LIBC_SONAME, memcpyZAGLIBCZu2Zd2Zd5) /* memcpy@GLIBC_2.2.5 */
|
|
Jakub Jelinek |
6e9276 |
+#endif
|
|
Jakub Jelinek |
6e9276 |
|
|
Jakub Jelinek |
6e9276 |
#define BCOPY(soname, fnname) \
|
|
Jakub Jelinek |
6e9276 |
void VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|