From owner-svn-src-all@freebsd.org Tue Jul 4 20:19:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74B96D9A44E; Tue, 4 Jul 2017 20:19:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41F9B2AD2; Tue, 4 Jul 2017 20:19:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v64KJak9090533; Tue, 4 Jul 2017 20:19:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v64KJatG090532; Tue, 4 Jul 2017 20:19:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707042019.v64KJatG090532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Jul 2017 20:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320658 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 320658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 20:19:37 -0000 Author: kib Date: Tue Jul 4 20:19:36 2017 New Revision: 320658 URL: https://svnweb.freebsd.org/changeset/base/320658 Log: When reporting undefined symbol, note the version, if specified. Use the standard syntax of name@version, I do not expect a confusion due to unlikely possibility of the name containing the '@' character. Requested by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Jul 4 18:48:08 2017 (r320657) +++ head/libexec/rtld-elf/rtld.c Tue Jul 4 20:19:36 2017 (r320658) @@ -1659,6 +1659,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref const Elf_Sym *ref; const Elf_Sym *def; const Obj_Entry *defobj; + const Ver_Entry *ve; SymLook req; const char *name; int res; @@ -1678,6 +1679,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref name = refobj->strtab + ref->st_name; def = NULL; defobj = NULL; + ve = NULL; /* * We don't have to do a full scale lookup if the symbol is local. @@ -1694,7 +1696,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref } symlook_init(&req, name); req.flags = flags; - req.ventry = fetch_ventry(refobj, symnum); + ve = req.ventry = fetch_ventry(refobj, symnum); req.lockstate = lockstate; res = symlook_default(&req, refobj); if (res == 0) { @@ -1724,7 +1726,8 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref } } else { if (refobj != &obj_rtld) - _rtld_error("%s: Undefined symbol \"%s\"", refobj->path, name); + _rtld_error("%s: Undefined symbol \"%s%s%s\"", refobj->path, name, + ve != NULL ? "@" : "", ve != NULL ? ve->name : ""); } return def; } @@ -3489,7 +3492,8 @@ do_dlsym(void *handle, const char *name, void *retaddr return (sym); } - _rtld_error("Undefined symbol \"%s\"", name); + _rtld_error("Undefined symbol \"%s%s%s\"", name, ve != NULL ? "@" : "", + ve != NULL ? ve->name : ""); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); return NULL;