From: Julian Seward Date: Sun, 21 Dec 2003 23:54:59 +0000 (+0000) Subject: Use the redir machinery to forcibly remap stpcpy in libc.so.6 to our X-Git-Tag: svn/VALGRIND_2_1_1~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79c85b65bfcdfec81aa94293f3b03b68ad13d6c6;p=thirdparty%2Fvalgrind.git Use the redir machinery to forcibly remap stpcpy in libc.so.6 to our own version in mac_replace_strmem.c. We have to do this the hard way because overenthusiastic PLT bypassing in glibc means the usual symbol-override stuff doesn't work. IOW, for the usual reason that we have to use the redir machinery at all. This makes many programs run much more quietly on SuSE 9. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2139 --- diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index bed06c4db1..35bddcbfc5 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -2106,6 +2106,11 @@ void VG_(add_redirect_sym)(const Char *from_lib, const Char *from_sym, redir->to_sym = VG_(arena_strdup)(VG_AR_SYMTAB, to_sym); redir->to_addr = 0; + if (VG_(clo_verbosity) >= 2) + VG_(message)(Vg_UserMsg, + "REDIRECT %s(%s) to %s(%s)", + from_lib, from_sym, to_lib, to_sym); + if (!resolve_redir_allsegs(redir)) { /* can't resolve immediately; add to list */ redir->next = unresolved_redir; @@ -2163,13 +2168,14 @@ void VG_(setup_code_redirect_table) ( void ) for(i = 0; i < sizeof(redirects)/sizeof(*redirects); i++) { VG_(add_redirect_sym)("soname:libc.so.6", redirects[i].from, "soname:libpthread.so.0", redirects[i].to); - - if (VG_(clo_verbosity) >= 2) - VG_(message)(Vg_UserMsg, - "REPLACING libc(%s) with libpthread(%s)", - redirects[i].from, redirects[i].to); } + /* Overenthusiastic use of PLT bypassing by the glibc people also + means we need to patch the following functions to our own + implementations of said, in mac_replace_strmem.c. + */ + VG_(add_redirect_sym)("soname:libc.so.6", "stpcpy", + "*vgpreload_memcheck.so*", "stpcpy"); } /*------------------------------------------------------------*/