]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Use the redir machinery to forcibly remap stpcpy in libc.so.6 to our
authorJulian Seward <jseward@acm.org>
Sun, 21 Dec 2003 23:54:59 +0000 (23:54 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 21 Dec 2003 23:54:59 +0000 (23:54 +0000)
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

coregrind/vg_symtab2.c

index bed06c4db1bd4832a71308131fe08329a9284a6e..35bddcbfc554138cd1f18326b9b0e4dbe7c6d01a 100644 (file)
@@ -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");
 }
 
 /*------------------------------------------------------------*/