Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 2009 20:21:43 GMT
From:      Stanislav Sedov <stas@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 167190 for review
Message-ID:  <200908102021.n7AKLh6b082502@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167190

Change 167190 by stas@stas_orion on 2009/08/10 20:21:37

	- For DSOs use filename for DebugInfo soname if .soname isn't available.
	         This fixes spontaneous warnings on unitialised variables in ld-elf.so.1,
	  as without properly initialized soname valgrind is unable to replace
	         important functions in ld.so, which confused it.

Affected files ...

.. //depot/projects/valgrind/coregrind/m_debuginfo/readelf.c#6 edit

Differences ...

==== //depot/projects/valgrind/coregrind/m_debuginfo/readelf.c#6 (text+ko) ====

@@ -1210,7 +1210,8 @@
             prev_svma = phdr->p_vaddr;
          }
 
-         /* Try to get the soname.  If there isn't one, use "NONE".
+         /* Try to get the soname.  If there isn't one, try to use last
+            component of filename instead in DSO case. Otherwise use "NONE".
             The seginfo needs to have some kind of soname in order to
             facilitate writing redirect functions, since all redirect
             specifications require a soname (pattern). */
@@ -1254,6 +1255,19 @@
 
    /* If, after looking at all the program headers, we still didn't 
       find a soname, add a fake one. */
+   if (di->soname == NULL && ehdr_img->e_type == ET_DYN && di->filename != NULL) {
+         char *filename = di->filename;
+         char *p = filename + VG_(strlen)(filename);
+         /* Extract last component. */
+         while (*p != '/' && p > filename)
+            p--;
+         if (*p == '/')
+            p++;
+         if (*p != '\0') {
+            TRACE_SYMTAB("No soname found; using filename instead\n");
+            di->soname = ML_(dinfo_strdup)("di.redi.1", p);
+         }
+   }
    if (di->soname == NULL) {
       TRACE_SYMTAB("No soname found; using (fake) \"NONE\"\n");
       di->soname = "NONE";



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908102021.n7AKLh6b082502>