PERFORCE change 167190 for review
Stanislav Sedov
stas at FreeBSD.org
Mon Aug 10 20:21:45 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167190
Change 167190 by stas at 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";
More information about the p4-projects
mailing list