From owner-p4-projects@FreeBSD.ORG Mon Aug 10 20:21:44 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 16BE41065674; Mon, 10 Aug 2009 20:21:44 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9183106566C for ; Mon, 10 Aug 2009 20:21:43 +0000 (UTC) (envelope-from stas@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B88418FC35 for ; Mon, 10 Aug 2009 20:21:43 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n7AKLhBF082504 for ; Mon, 10 Aug 2009 20:21:43 GMT (envelope-from stas@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7AKLh6b082502 for perforce@freebsd.org; Mon, 10 Aug 2009 20:21:43 GMT (envelope-from stas@freebsd.org) Date: Mon, 10 Aug 2009 20:21:43 GMT Message-Id: <200908102021.n7AKLh6b082502@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to stas@freebsd.org using -f From: Stanislav Sedov To: Perforce Change Reviews Cc: Subject: PERFORCE change 167190 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2009 20:21:45 -0000 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";