DARWIN branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9130
#include "pub_core_redir.h" // for VG_REPLACE_FUNCTION_*
#include "pub_core_replacemalloc.h"
-/* --------- Some handy Z-encoded names. --------- */
-
-/* --- Soname of the standard C library. --- */
-
-#if defined(VGO_linux)
-# define m_libc_soname libcZdsoZa // libc.so*
-#elif defined(VGP_ppc32_aix5)
- /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
-# define m_libc_soname libcZaZdaZLshrZdoZR // libc*.a(shr.o)
-#elif defined(VGP_ppc64_aix5)
-# define m_libc_soname libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
-#else
-# error "Unknown platform"
-#endif
-
-/* --- Soname of the GNU C++ library. --- */
-
-#define m_libstdcxx_soname libstdcZpZpZa // libstdc++*
-
-/* --- Soname of XLC's C++ library. --- */
-
-/* AIX: xlC's C++ runtime library is called libC.a, and the
- interesting symbols appear to be in ansicore_32.o or ansicore_64.o
- respectively. */
-#if defined(VGP_ppc32_aix5)
-# define m_libC_dot_a libCZdaZLansicoreZu32ZdoZR // libC.a(ansicore_32.o)
-#elif defined(VGP_ppc64_aix5)
-# define m_libC_dot_a libCZdaZLansicoreZu64ZdoZR // libC.a(ansicore_64.o)
-#endif
-
/* 2 Apr 05: the Portland Group compiler, which uses cfront/ARM style
mangling, could be supported properly by the redirects in this
// (from_so, from_fn, v's replacement)
// malloc
-ALLOC_or_NULL(m_libstdcxx_soname, malloc, malloc);
-ALLOC_or_NULL(m_libc_soname, malloc, malloc);
+ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, malloc, malloc);
+ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc, malloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-ALLOC_or_NULL(m_libc_soname, malloc_common, malloc);
+ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc_common, malloc);
#endif
/*---------------------- new ----------------------*/
// operator new(unsigned int), not mangled (for gcc 2.96)
-ALLOC_or_BOMB(m_libstdcxx_soname, builtin_new, __builtin_new);
-ALLOC_or_BOMB(m_libc_soname, builtin_new, __builtin_new);
+ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, builtin_new, __builtin_new);
+ALLOC_or_BOMB(VG_Z_LIBC_SONAME, builtin_new, __builtin_new);
-ALLOC_or_BOMB(m_libstdcxx_soname, __builtin_new, __builtin_new);
-ALLOC_or_BOMB(m_libc_soname, __builtin_new, __builtin_new);
+ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, __builtin_new, __builtin_new);
+ALLOC_or_BOMB(VG_Z_LIBC_SONAME, __builtin_new, __builtin_new);
// operator new(unsigned int), GNU mangling
#if VG_WORDSIZE == 4
- ALLOC_or_BOMB(m_libstdcxx_soname, _Znwj, __builtin_new);
- ALLOC_or_BOMB(m_libc_soname, _Znwj, __builtin_new);
+ ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwj, __builtin_new);
+ ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwj, __builtin_new);
#endif
// operator new(unsigned long), GNU mangling
#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5)
- ALLOC_or_BOMB(m_libstdcxx_soname, _Znwm, __builtin_new);
- ALLOC_or_BOMB(m_libc_soname, _Znwm, __builtin_new);
+ ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwm, __builtin_new);
+ ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwm, __builtin_new);
#endif
// operator new(unsigned long), ARM/cfront mangling
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(m_libC_dot_a, __nw__FUl, __builtin_new);
+ ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __nw__FUl, __builtin_new);
#endif
// operator new(unsigned, std::nothrow_t const&), GNU mangling
#if VG_WORDSIZE == 4
- ALLOC_or_NULL(m_libstdcxx_soname, _ZnwjRKSt9nothrow_t, __builtin_new);
- ALLOC_or_NULL(m_libc_soname, _ZnwjRKSt9nothrow_t, __builtin_new);
+ ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
+ ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
#endif
// operator new(unsigned long, std::nothrow_t const&), GNU mangling
#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_NULL(m_libstdcxx_soname, _ZnwmRKSt9nothrow_t, __builtin_new);
- ALLOC_or_NULL(m_libc_soname, _ZnwmRKSt9nothrow_t, __builtin_new);
+ ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwmRKSt9nothrow_t, __builtin_new);
+ ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwmRKSt9nothrow_t, __builtin_new);
#endif
// operator new(unsigned long, std::nothrow_t const&), ARM/cfront mangling
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_NULL(m_libC_dot_a, __nw__FUlRCQ2_3std9nothrow_t, __builtin_new);
+ ALLOC_or_NULL(VG_Z_LIBC_DOT_A, __nw__FUlRCQ2_3std9nothrow_t, __builtin_new);
#endif
/*---------------------- new [] ----------------------*/
// operator new[](unsigned int), not mangled (for gcc 2.96)
-ALLOC_or_BOMB(m_libstdcxx_soname, __builtin_vec_new, __builtin_vec_new );
-ALLOC_or_BOMB(m_libc_soname, __builtin_vec_new, __builtin_vec_new );
+ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, __builtin_vec_new, __builtin_vec_new );
+ALLOC_or_BOMB(VG_Z_LIBC_SONAME, __builtin_vec_new, __builtin_vec_new );
// operator new[](unsigned int), GNU mangling
#if VG_WORDSIZE == 4
- ALLOC_or_BOMB(m_libstdcxx_soname, _Znaj, __builtin_vec_new );
- ALLOC_or_BOMB(m_libc_soname, _Znaj, __builtin_vec_new );
+ ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znaj, __builtin_vec_new );
+ ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znaj, __builtin_vec_new );
#endif
// operator new[](unsigned long), GNU mangling
#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(m_libstdcxx_soname, _Znam, __builtin_vec_new );
- ALLOC_or_BOMB(m_libc_soname, _Znam, __builtin_vec_new );
+ ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znam, __builtin_vec_new );
+ ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znam, __builtin_vec_new );
#endif
// operator new[](unsigned long), ARM/cfront mangling
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(m_libC_dot_a, __vn__FUl, __builtin_vec_new);
+ ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUl, __builtin_vec_new);
#endif
// operator new[](unsigned, std::nothrow_t const&), GNU mangling
#if VG_WORDSIZE == 4
- ALLOC_or_NULL(m_libstdcxx_soname, _ZnajRKSt9nothrow_t, __builtin_vec_new );
- ALLOC_or_NULL(m_libc_soname, _ZnajRKSt9nothrow_t, __builtin_vec_new );
+ ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
+ ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
#endif
// operator new[](unsigned long, std::nothrow_t const&), GNU mangling
#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_NULL(m_libstdcxx_soname, _ZnamRKSt9nothrow_t, __builtin_vec_new );
- ALLOC_or_NULL(m_libc_soname, _ZnamRKSt9nothrow_t, __builtin_vec_new );
+ ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new );
+ ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new );
#endif
// operator new [](unsigned long, std::nothrow_t const&), ARM/cfront mangling
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(m_libC_dot_a, __vn__FUlRCQ2_3std9nothrow_t, __builtin_vec_new );
+ ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUlRCQ2_3std9nothrow_t, __builtin_vec_new );
#endif
}
// free
-FREE(m_libstdcxx_soname, free, free );
-FREE(m_libc_soname, free, free );
+FREE(VG_Z_LIBSTDCXX_SONAME, free, free );
+FREE(VG_Z_LIBC_SONAME, free, free );
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-FREE(m_libc_soname, free_common, free );
+FREE(VG_Z_LIBC_SONAME, free_common, free );
#endif
/*---------------------- cfree ----------------------*/
// cfree
-FREE(m_libstdcxx_soname, cfree, free );
-FREE(m_libc_soname, cfree, free );
+FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free );
+FREE(VG_Z_LIBC_SONAME, cfree, free );
/*---------------------- delete ----------------------*/
// operator delete(void*), not mangled (for gcc 2.96)
-FREE(m_libstdcxx_soname, __builtin_delete, __builtin_delete );
-FREE(m_libc_soname, __builtin_delete, __builtin_delete );
+FREE(VG_Z_LIBSTDCXX_SONAME, __builtin_delete, __builtin_delete );
+FREE(VG_Z_LIBC_SONAME, __builtin_delete, __builtin_delete );
// operator delete(void*), GNU mangling
-FREE(m_libstdcxx_soname, _ZdlPv, __builtin_delete );
-FREE(m_libc_soname, _ZdlPv, __builtin_delete );
+FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPv, __builtin_delete );
+FREE(VG_Z_LIBC_SONAME, _ZdlPv, __builtin_delete );
// operator delete(void*), ARM/cfront mangling
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-FREE(m_libC_dot_a, __dl__FPv, __builtin_delete );
+FREE(VG_Z_LIBC_DOT_A, __dl__FPv, __builtin_delete );
#endif
/*---------------------- delete nothrow ----------------------*/
// operator delete(void*, std::nothrow_t const&), GNU mangling
-FREE(m_libstdcxx_soname, _ZdlPvRKSt9nothrow_t, __builtin_delete );
-FREE(m_libc_soname, _ZdlPvRKSt9nothrow_t, __builtin_delete );
+FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete );
+FREE(VG_Z_LIBC_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete );
/*---------------------- delete [] ----------------------*/
// operator delete[](void*), not mangled (for gcc 2.96)
-FREE(m_libstdcxx_soname, __builtin_vec_delete, __builtin_vec_delete );
-FREE(m_libc_soname, __builtin_vec_delete, __builtin_vec_delete );
+FREE(VG_Z_LIBSTDCXX_SONAME, __builtin_vec_delete, __builtin_vec_delete );
+FREE(VG_Z_LIBC_SONAME, __builtin_vec_delete, __builtin_vec_delete );
// operator delete[](void*), GNU mangling
-FREE(m_libstdcxx_soname, _ZdaPv, __builtin_vec_delete );
-FREE(m_libc_soname, _ZdaPv, __builtin_vec_delete );
+FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPv, __builtin_vec_delete );
+FREE(VG_Z_LIBC_SONAME, _ZdaPv, __builtin_vec_delete );
// operator delete[](void*), ARM/cfront mangling
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-FREE(m_libC_dot_a, __vd__FPv, __builtin_vec_delete );
+FREE(VG_Z_LIBC_DOT_A, __vd__FPv, __builtin_vec_delete );
#endif
/*---------------------- delete [] nothrow ----------------------*/
// operator delete[](void*, std::nothrow_t const&), GNU mangling
-FREE(m_libstdcxx_soname, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
-FREE(m_libc_soname, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
+FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
+FREE(VG_Z_LIBC_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
/*---------------------- calloc ----------------------*/
return v; \
}
-CALLOC(m_libc_soname, calloc);
+CALLOC(VG_Z_LIBC_SONAME, calloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-CALLOC(m_libc_soname, calloc_common);
+CALLOC(VG_Z_LIBC_SONAME, calloc_common);
#endif
if (ptrV == NULL) \
/* We need to call a malloc-like function; so let's use \
one which we know exists. */ \
- return VG_REPLACE_FUNCTION_ZU(m_libc_soname,malloc) (new_size); \
+ return VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,malloc) (new_size); \
if (new_size <= 0) { \
- VG_REPLACE_FUNCTION_ZU(m_libc_soname,free)(ptrV); \
+ VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,free)(ptrV); \
MALLOC_TRACE(" = 0"); \
return NULL; \
} \
return v; \
}
-REALLOC(m_libc_soname, realloc);
+REALLOC(VG_Z_LIBC_SONAME, realloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-REALLOC(m_libc_soname, realloc_common);
+REALLOC(VG_Z_LIBC_SONAME, realloc_common);
#endif
return v; \
}
-MEMALIGN(m_libc_soname, memalign);
+MEMALIGN(VG_Z_LIBC_SONAME, memalign);
/*---------------------- valloc ----------------------*/
static int pszB = 0; \
if (pszB == 0) \
pszB = local__getpagesize(); \
- return VG_REPLACE_FUNCTION_ZU(m_libc_soname,memalign) \
+ return VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,memalign) \
((SizeT)pszB, size); \
}
-VALLOC(m_libc_soname, valloc);
+VALLOC(VG_Z_LIBC_SONAME, valloc);
/*---------------------- mallopt ----------------------*/
return 1; \
}
-MALLOPT(m_libc_soname, mallopt);
+MALLOPT(VG_Z_LIBC_SONAME, mallopt);
/*---------------------- malloc_trim ----------------------*/
return 0; \
}
-MALLOC_TRIM(m_libc_soname, malloc_trim);
+MALLOC_TRIM(VG_Z_LIBC_SONAME, malloc_trim);
/*---------------------- posix_memalign ----------------------*/
|| (alignment & (alignment - 1)) != 0) \
return VKI_EINVAL; \
\
- mem = VG_REPLACE_FUNCTION_ZU(m_libc_soname,memalign)(alignment, size); \
+ mem = VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,memalign)(alignment, size); \
\
if (mem != NULL) { \
*memptr = mem; \
return VKI_ENOMEM; \
}
-POSIX_MEMALIGN(m_libc_soname, posix_memalign);
+POSIX_MEMALIGN(VG_Z_LIBC_SONAME, posix_memalign);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
/* 27 Nov 07: it appears that xlc links into executables, a
posix_memalign, which calls onwards to memalign_common, with the
same args. */
-POSIX_MEMALIGN(m_libc_soname, memalign_common);
+POSIX_MEMALIGN(VG_Z_LIBC_SONAME, memalign_common);
#endif
return pszB; \
}
-MALLOC_USABLE_SIZE(m_libc_soname, malloc_usable_size);
+MALLOC_USABLE_SIZE(VG_Z_LIBC_SONAME, malloc_usable_size);
/*---------------------- (unimplemented) ----------------------*/
panic(#fnname); \
}
-PANIC(m_libc_soname, pvalloc);
-PANIC(m_libc_soname, malloc_get_state);
-PANIC(m_libc_soname, malloc_set_state);
+PANIC(VG_Z_LIBC_SONAME, pvalloc);
+PANIC(VG_Z_LIBC_SONAME, malloc_get_state);
+PANIC(VG_Z_LIBC_SONAME, malloc_set_state);
#define MALLOC_STATS(soname, fnname) \
\
/* Valgrind's malloc_stats implementation does nothing. */ \
}
-MALLOC_STATS(m_libc_soname, malloc_stats);
+MALLOC_STATS(VG_Z_LIBC_SONAME, malloc_stats);
/*---------------------- mallinfo ----------------------*/
return mi; \
}
-MALLINFO(m_libc_soname, mallinfo);
+MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
/* All the code in here is unused until this function is called */
#include "valgrind.h"
-/* --------- Some handy Z-encoded names. --------- */
-
-/* --- Soname of the standard C library. --- */
-
-#if defined(VGO_linux)
-# define m_libc_soname libcZdsoZa // libc.so*
-#elif defined(VGP_ppc32_aix5)
- /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
-# define m_libc_soname libcZaZdaZLshrZdoZR // libc*.a(shr.o)
-#elif defined(VGP_ppc64_aix5)
-# define m_libc_soname libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
-#else
-# error "Unknown platform"
-#endif
-
-/* --- Sonames for Linux ELF linkers. --- */
-
-#define m_ld_linux_so_2 ldZhlinuxZdsoZd2 // ld-linux.so.2
-#define m_ld_linux_x86_64_so_2 ldZhlinuxZhx86Zh64ZdsoZd2 // ld-linux-x86-64.so.2
-#define m_ld64_so_1 ld64ZdsoZd1 // ld64.so.1
-#define m_ld_so_1 ldZdsoZd1 // ld.so.1
-
-
#define STRNLEN(soname, fnname) \
SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ); \
SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ) \
return i; \
}
-STRNLEN(m_libc_soname, strnlen)
+STRNLEN(VG_Z_LIBC_SONAME, strnlen)
// Note that this replacement often doesn't get used because gcc inlines
return i; \
}
-STRLEN(m_libc_soname, strlen)
-STRLEN(m_ld_linux_so_2, strlen)
-STRLEN(m_ld_linux_x86_64_so_2, strlen)
+STRLEN(VG_Z_LIBC_SONAME, strlen)
+STRLEN(VG_Z_LD_LINUX_SO_2, strlen)
+STRLEN(VG_Z_LD_LINUX_X86_64_SO_2, strlen)
/*--------------------------------------------------------------------*/
/*--- end ---*/
memcheck/mc_replace_strmem.c. If you copy more in, please keep
them in the same order as in mc_replace_strmem.c. */
-/* --------- Some handy Z-encoded names. --------- */
-
-/* --- Soname of the standard C library. --- */
-
-#if defined(VGO_linux)
-# define m_libc_soname libcZdsoZa // libc.so*
-#elif defined(VGP_ppc32_aix5)
- /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
-# define m_libc_soname libcZaZdaZLshrZdoZR // libc*.a(shr.o)
-#elif defined(VGP_ppc64_aix5)
-# define m_libc_soname libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
-#else
-# error "Unknown platform"
-#endif
-
-/* --- Sonames for Linux ELF linkers. --- */
-
-#define m_ld_linux_so_2 ldZhlinuxZdsoZd2 // ld-linux.so.2
-#define m_ld_linux_x86_64_so_2 ldZhlinuxZhx86Zh64ZdsoZd2 // ld-linux-x86-64.so.2
-#define m_ld64_so_1 ld64ZdsoZd1 // ld64.so.1
-#define m_ld_so_1 ldZdsoZd1 // ld.so.1
-
-
-
#define STRNLEN(soname, fnname) \
SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ); \
return i; \
}
-STRNLEN(m_libc_soname, strnlen)
+STRNLEN(VG_Z_LIBC_SONAME, strnlen)
// Note that this replacement often doesn't get used because gcc inlines
return i; \
}
-STRLEN(m_libc_soname, strlen)
-STRLEN(m_ld_linux_so_2, strlen)
-STRLEN(m_ld_linux_x86_64_so_2, strlen)
-STRLEN(m_ld_so_1, strlen)
+STRLEN(VG_Z_LIBC_SONAME, strlen)
+STRLEN(VG_Z_LD_LINUX_SO_2, strlen)
+STRLEN(VG_Z_LD_LINUX_X86_64_SO_2, strlen)
+STRLEN(VG_Z_LD_SO_1, strlen)
#define STRCMP(soname, fnname) \
return 0; \
}
-STRCMP(m_libc_soname, strcmp)
-STRCMP(m_ld_linux_x86_64_so_2, strcmp)
-STRCMP(m_ld64_so_1, strcmp)
+STRCMP(VG_Z_LIBC_SONAME, strcmp)
+STRCMP(VG_Z_LD_LINUX_X86_64_SO_2, strcmp)
+STRCMP(VG_Z_LD64_SO_1, strcmp)
#define MEMCPY(soname, fnname) \
return dest; \
}
-MEMCPY(m_libc_soname, memcpy)
-MEMCPY(m_ld_so_1, memcpy) /* ld.so.1 */
-MEMCPY(m_ld64_so_1, memcpy) /* ld64.so.1 */
+MEMCPY(VG_Z_LIBC_SONAME, memcpy)
+MEMCPY(VG_Z_LD_SO_1, memcpy) /* ld.so.1 */
+MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64.so.1 */
/* Copy SRC to DEST, returning the address of the terminating '\0' in
return dst; \
}
-STPCPY(m_libc_soname, stpcpy)
-STPCPY(m_ld_linux_so_2, stpcpy)
-STPCPY(m_ld_linux_x86_64_so_2, stpcpy)
+STPCPY(VG_Z_LIBC_SONAME, stpcpy)
+STPCPY(VG_Z_LD_LINUX_SO_2, stpcpy)
+STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
/*--------------------------------------------------------------------*/
Invalid read of size 1
- at 0x........: strlen (h_intercepts.c:97)
+ at 0x........: strlen (h_intercepts.c:...)
by 0x........: ...
by 0x........: ...
by 0x........: VG_print_translation_stats (bad_percentify.c:88)
Actual: unknown
Invalid read of size 1
- at 0x........: strlen (h_intercepts.c:97)
+ at 0x........: strlen (h_intercepts.c:...)
by 0x........: ...
by 0x........: ...
by 0x........: VG_print_translation_stats (bad_percentify.c:93)
Actual: unknown
Invalid read of size 1
- at 0x........: strlen (h_intercepts.c:97)
+ at 0x........: strlen (h_intercepts.c:...)
by 0x........: ...
by 0x........: ...
by 0x........: VG_print_translation_stats (bad_percentify.c:98)
-e "s/printf (printf.c:[0-9]*)/.../" \
-e "s/strdup (strdup.c:[0-9]*)/.../" \
-e "s/pthread_key_create.c:[0-9]*/in \/...libpthread.../" \
--e "s/genops.c:[0-9]*/in \/...libc.../"
+-e "s/genops.c:[0-9]*/in \/...libc.../" |
+
+# Anonymise line numbers in h_intercepts.c.
+sed "s/h_intercepts.c:[0-9]*/h_intercepts.c:.../"
+
new functions, please keep them in the same order as they appear in
mc_replace_strmem.c. */
-/* --------- Some handy Z-encoded names. --------- */
-
-/* --- Soname of the standard C library. --- */
-
-#if defined(VGO_linux)
-# define m_libc_soname libcZdsoZa // libc.so*
-#elif defined(VGP_ppc32_aix5)
- /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
-# define m_libc_soname libcZaZdaZLshrZdoZR // libc*.a(shr.o)
-#elif defined(VGP_ppc64_aix5)
-# define m_libc_soname libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
-#else
-# error "Unknown platform"
-#endif
-
-/* --- Sonames for Linux ELF linkers. --- */
-
-#define m_ld_linux_so_2 ldZhlinuxZdsoZd2 // ld-linux.so.2
-#define m_ld_linux_x86_64_so_2 ldZhlinuxZhx86Zh64ZdsoZd2 // ld-linux-x86-64.so.2
-#define m_ld64_so_1 ld64ZdsoZd1 // ld64.so.1
-#define m_ld_so_1 ldZdsoZd1 // ld.so.1
-
#define STRCHR(soname, fnname) \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ); \
}
// Apparently index() is the same thing as strchr()
-STRCHR(m_libc_soname, strchr)
-STRCHR(m_ld_linux_so_2, strchr)
-STRCHR(m_ld_linux_x86_64_so_2, strchr)
-STRCHR(m_libc_soname, index)
-STRCHR(m_ld_linux_so_2, index)
-STRCHR(m_ld_linux_x86_64_so_2, index)
+STRCHR(VG_Z_LIBC_SONAME, strchr)
+STRCHR(VG_Z_LD_LINUX_SO_2, strchr)
+STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, strchr)
+STRCHR(VG_Z_LIBC_SONAME, index)
+STRCHR(VG_Z_LD_LINUX_SO_2, index)
+STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, index)
// Note that this replacement often doesn't get used because gcc inlines
return i; \
}
-STRLEN(m_libc_soname, strlen)
-STRLEN(m_ld_linux_so_2, strlen)
-STRLEN(m_ld_linux_x86_64_so_2, strlen)
+STRLEN(VG_Z_LIBC_SONAME, strlen)
+STRLEN(VG_Z_LD_LINUX_SO_2, strlen)
+STRLEN(VG_Z_LD_LINUX_X86_64_SO_2, strlen)
#define STRCPY(soname, fnname) \
return (char*)dst_orig; \
}
-STRCPY(m_libc_soname, strcpy)
+STRCPY(VG_Z_LIBC_SONAME, strcpy)
#define STRCMP(soname, fnname) \
return 0; \
}
-STRCMP(m_libc_soname, strcmp)
-STRCMP(m_ld_linux_x86_64_so_2, strcmp)
-STRCMP(m_ld64_so_1, strcmp)
+STRCMP(VG_Z_LIBC_SONAME, strcmp)
+STRCMP(VG_Z_LD_LINUX_X86_64_SO_2, strcmp)
+STRCMP(VG_Z_LD64_SO_1, strcmp)
#define MEMCPY(soname, fnname) \
return dst; \
}
-MEMCPY(m_libc_soname, memcpy)
-MEMCPY(m_ld_so_1, memcpy) /* ld.so.1 */
-MEMCPY(m_ld64_so_1, memcpy) /* ld64.so.1 */
+MEMCPY(VG_Z_LIBC_SONAME, memcpy)
+MEMCPY(VG_Z_LD_SO_1, memcpy) /* ld.so.1 */
+MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64.so.1 */
/* icc9 blats these around all over the place. Not only in the main
executable but various .so's. They are highly tuned and read
memory beyond the source boundary (although work correctly and
#define VG_WRAP_FUNCTION_ZU(soname,fnname) VG_CONCAT4(_vgwZU_,soname,_,fnname)
#define VG_WRAP_FUNCTION_ZZ(soname,fnname) VG_CONCAT4(_vgwZZ_,soname,_,fnname)
+/* --------- Some handy Z-encoded names. --------- */
+
+/* --- Soname of the standard C library. --- */
+
+#if defined(VGO_linux)
+# define VG_Z_LIBC_SONAME libcZdsoZa // libc.so*
+#elif defined(VGP_ppc32_aix5)
+ /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
+# define VG_Z_LIBC_SONAME libcZaZdaZLshrZdoZR // libc*.a(shr.o)
+#elif defined(VGP_ppc64_aix5)
+# define VG_Z_LIBC_SONAME libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
+#else
+# error "Unknown platform"
+#endif
+
+/* --- Soname of the GNU C++ library. --- */
+
+// DDD: this one and those below should probably be conditionally compiled,
+// as should all the redirects in the tools that use them.
+#define VG_Z_LIBSTDCXX_SONAME libstdcZpZpZa // libstdc++*
+
+/* --- Soname of XLC's C++ library. --- */
+
+/* AIX: xlC's C++ runtime library is called libC.a, and the
+ interesting symbols appear to be in ansicore_32.o or ansicore_64.o
+ respectively. */
+#if defined(VGP_ppc32_aix5)
+# define VG_Z_LIBC_DOT_A libCZdaZLansicoreZu32ZdoZR // libC.a(ansicore_32.o)
+#elif defined(VGP_ppc64_aix5)
+# define VG_Z_LIBC_DOT_A libCZdaZLansicoreZu64ZdoZR // libC.a(ansicore_64.o)
+#endif
+
+/* --- Sonames for Linux ELF linkers. --- */
+
+#define VG_Z_LD_LINUX_SO_2 ldZhlinuxZdsoZd2 // ld-linux.so.2
+#define VG_Z_LD_LINUX_X86_64_SO_2 ldZhlinuxZhx86Zh64ZdsoZd2 // ld-linux-x86-64.so.2
+#define VG_Z_LD64_SO_1 ld64ZdsoZd1 // ld64.so.1
+#define VG_Z_LD_SO_1 ldZdsoZd1 // ld.so.1
+
#endif // __PUB_TOOL_REDIR_H
s, src, dst, len, 0); \
}
-/* --------- Some handy Z-encoded names. --------- */
-
-/* --- Soname of the standard C library. --- */
-
-#if defined(VGO_linux)
-# define m_libc_soname libcZdsoZa // libc.so*
-#elif defined(VGP_ppc32_aix5)
- /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
-# define m_libc_soname libcZaZdaZLshrZdoZR // libc*.a(shr.o)
-#elif defined(VGP_ppc64_aix5)
-# define m_libc_soname libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
-#else
-# error "Unknown platform"
-#endif
-
-/* --- Sonames for Linux ELF linkers. --- */
-
-#define m_ld_linux_so_2 ldZhlinuxZdsoZd2 // ld-linux.so.2
-#define m_ld_linux_x86_64_so_2 ldZhlinuxZhx86Zh64ZdsoZd2 // ld-linux-x86-64.so.2
-#define m_ld64_so_1 ld64ZdsoZd1 // ld64.so.1
-#define m_ld_so_1 ldZdsoZd1 // ld.so.1
-
#define STRRCHR(soname, fnname) \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* s, int c ); \
}
// Apparently rindex() is the same thing as strrchr()
-STRRCHR(m_libc_soname, strrchr)
-STRRCHR(m_libc_soname, rindex)
-STRRCHR(m_ld_linux_so_2, rindex)
+STRRCHR(VG_Z_LIBC_SONAME, strrchr)
+STRRCHR(VG_Z_LIBC_SONAME, rindex)
+STRRCHR(VG_Z_LD_LINUX_SO_2, rindex)
#define STRCHR(soname, fnname) \
}
// Apparently index() is the same thing as strchr()
-STRCHR(m_libc_soname, strchr)
-STRCHR(m_ld_linux_so_2, strchr)
-STRCHR(m_ld_linux_x86_64_so_2, strchr)
-STRCHR(m_libc_soname, index)
-STRCHR(m_ld_linux_so_2, index)
-STRCHR(m_ld_linux_x86_64_so_2, index)
+STRCHR(VG_Z_LIBC_SONAME, strchr)
+STRCHR(VG_Z_LD_LINUX_SO_2, strchr)
+STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, strchr)
+STRCHR(VG_Z_LIBC_SONAME, index)
+STRCHR(VG_Z_LD_LINUX_SO_2, index)
+STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, index)
#define STRCAT(soname, fnname) \
return dst_orig; \
}
-STRCAT(m_libc_soname, strcat)
+STRCAT(VG_Z_LIBC_SONAME, strcat)
#define STRNCAT(soname, fnname) \
return dst_orig; \
}
-STRNCAT(m_libc_soname, strncat)
+STRNCAT(VG_Z_LIBC_SONAME, strncat)
#define STRNLEN(soname, fnname) \
return i; \
}
-STRNLEN(m_libc_soname, strnlen)
+STRNLEN(VG_Z_LIBC_SONAME, strnlen)
// Note that this replacement often doesn't get used because gcc inlines
return i; \
}
-STRLEN(m_libc_soname, strlen)
-STRLEN(m_ld_linux_so_2, strlen)
-STRLEN(m_ld_linux_x86_64_so_2, strlen)
+STRLEN(VG_Z_LIBC_SONAME, strlen)
+STRLEN(VG_Z_LD_LINUX_SO_2, strlen)
+STRLEN(VG_Z_LD_LINUX_X86_64_SO_2, strlen)
#define STRCPY(soname, fnname) \
return dst_orig; \
}
-STRCPY(m_libc_soname, strcpy)
+STRCPY(VG_Z_LIBC_SONAME, strcpy)
#define STRNCPY(soname, fnname) \
return dst_orig; \
}
-STRNCPY(m_libc_soname, strncpy)
+STRNCPY(VG_Z_LIBC_SONAME, strncpy)
#define STRNCMP(soname, fnname) \
} \
}
-STRNCMP(m_libc_soname, strncmp)
+STRNCMP(VG_Z_LIBC_SONAME, strncmp)
#define STRCMP(soname, fnname) \
return 0; \
}
-STRCMP(m_libc_soname, strcmp)
-STRCMP(m_ld_linux_x86_64_so_2, strcmp)
-STRCMP(m_ld64_so_1, strcmp)
+STRCMP(VG_Z_LIBC_SONAME, strcmp)
+STRCMP(VG_Z_LD_LINUX_X86_64_SO_2, strcmp)
+STRCMP(VG_Z_LD64_SO_1, strcmp)
#define MEMCHR(soname, fnname) \
return NULL; \
}
-MEMCHR(m_libc_soname, memchr)
+MEMCHR(VG_Z_LIBC_SONAME, memchr)
#define MEMCPY(soname, fnname) \
return dst; \
}
-MEMCPY(m_libc_soname, memcpy)
-MEMCPY(m_ld_so_1, memcpy) /* ld.so.1 */
-MEMCPY(m_ld64_so_1, memcpy) /* ld64.so.1 */
+MEMCPY(VG_Z_LIBC_SONAME, memcpy)
+MEMCPY(VG_Z_LD_SO_1, memcpy) /* ld.so.1 */
+MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64.so.1 */
/* icc9 blats these around all over the place. Not only in the main
executable but various .so's. They are highly tuned and read
memory beyond the source boundary (although work correctly and
return 0; \
}
-MEMCMP(m_libc_soname, memcmp)
-MEMCMP(m_libc_soname, bcmp)
-MEMCMP(m_ld_so_1, bcmp)
+MEMCMP(VG_Z_LIBC_SONAME, memcmp)
+MEMCMP(VG_Z_LIBC_SONAME, bcmp)
+MEMCMP(VG_Z_LD_SO_1, bcmp)
/* Copy SRC to DEST, returning the address of the terminating '\0' in
return dst; \
}
-STPCPY(m_libc_soname, stpcpy)
-STPCPY(m_ld_linux_so_2, stpcpy)
-STPCPY(m_ld_linux_x86_64_so_2, stpcpy)
+STPCPY(VG_Z_LIBC_SONAME, stpcpy)
+STPCPY(VG_Z_LD_LINUX_SO_2, stpcpy)
+STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
#define MEMSET(soname, fnname) \
return s; \
}
-MEMSET(m_libc_soname, memset)
+MEMSET(VG_Z_LIBC_SONAME, memset)
#define MEMMOVE(soname, fnname) \
return dst; \
}
-MEMMOVE(m_libc_soname, memmove)
+MEMMOVE(VG_Z_LIBC_SONAME, memmove)
/* glibc 2.5 variant of memmove which checks the dest is big enough.
return NULL; \
}
-GLIBC25___MEMMOVE_CHK(m_libc_soname, __memmove_chk)
+GLIBC25___MEMMOVE_CHK(VG_Z_LIBC_SONAME, __memmove_chk)
/* Find the first occurrence of C in S or the final NUL byte. */
} \
}
-GLIBC232_STRCHRNUL(m_libc_soname, strchrnul)
+GLIBC232_STRCHRNUL(VG_Z_LIBC_SONAME, strchrnul)
/* Find the first occurrence of C in S. */
} \
}
-GLIBC232_RAWMEMCHR(m_libc_soname, rawmemchr)
+GLIBC232_RAWMEMCHR(VG_Z_LIBC_SONAME, rawmemchr)
/* glibc variant of strcpy that checks the dest is big enough.
return NULL; \
}
-GLIBC25___STRCPY_CHK(m_libc_soname, __strcpy_chk)
+GLIBC25___STRCPY_CHK(VG_Z_LIBC_SONAME, __strcpy_chk)
/* glibc variant of stpcpy that checks the dest is big enough.
return NULL; \
}
-GLIBC25___STPCPY_CHK(m_libc_soname, __stpcpy_chk)
+GLIBC25___STPCPY_CHK(VG_Z_LIBC_SONAME, __stpcpy_chk)
/* mempcpy */
return (void*)( ((char*)dst) + len_saved ); \
}
-GLIBC25_MEMPCPY(m_libc_soname, mempcpy)
-GLIBC25_MEMPCPY(m_ld_so_1, mempcpy) /* ld.so.1 */
+GLIBC25_MEMPCPY(VG_Z_LIBC_SONAME, mempcpy)
+GLIBC25_MEMPCPY(VG_Z_LD_SO_1, mempcpy) /* ld.so.1 */
#define GLIBC26___MEMCPY_CHK(soname, fnname) \
return NULL; \
}
-GLIBC26___MEMCPY_CHK(m_libc_soname, __memcpy_chk)
+GLIBC26___MEMCPY_CHK(VG_Z_LIBC_SONAME, __memcpy_chk)
/*------------------------------------------------------------*/
#if defined(VGO_linux)
/* putenv */
-int VG_WRAP_FUNCTION_ZU(m_libc_soname, putenv) (char* string);
-int VG_WRAP_FUNCTION_ZU(m_libc_soname, putenv) (char* string)
+int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, putenv) (char* string);
+int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, putenv) (char* string)
{
OrigFn fn;
Word result;
}
/* unsetenv */
-int VG_WRAP_FUNCTION_ZU(m_libc_soname, unsetenv) (const char* name);
-int VG_WRAP_FUNCTION_ZU(m_libc_soname, unsetenv) (const char* name)
+int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, unsetenv) (const char* name);
+int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, unsetenv) (const char* name)
{
OrigFn fn;
Word result;
}
/* setenv */
-int VG_WRAP_FUNCTION_ZU(m_libc_soname, setenv)
+int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, setenv)
(const char* name, const char* value, int overwrite);
-int VG_WRAP_FUNCTION_ZU(m_libc_soname, setenv)
+int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, setenv)
(const char* name, const char* value, int overwrite)
{
OrigFn fn;