From owner-svn-src-all@FreeBSD.ORG Sun Feb 6 09:33:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1A401065694; Sun, 6 Feb 2011 09:33:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEF108FC18; Sun, 6 Feb 2011 09:33:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p169X8Q5058842; Sun, 6 Feb 2011 09:33:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p169X8IZ058840; Sun, 6 Feb 2011 09:33:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201102060933.p169X8IZ058840@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Feb 2011 09:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218365 - stable/8/libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 06 Feb 2011 09:33:08 -0000 Author: kib Date: Sun Feb 6 09:33:08 2011 New Revision: 218365 URL: http://svn.freebsd.org/changeset/base/218365 Log: MFC r218098: Make ldd(1) work when versioned dependency file is cannot be loaded. MFC r218099: Fix grammar. Modified: stable/8/libexec/rtld-elf/rtld.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/rtld.c ============================================================================== --- stable/8/libexec/rtld-elf/rtld.c Sun Feb 6 08:46:37 2011 (r218364) +++ stable/8/libexec/rtld-elf/rtld.c Sun Feb 6 09:33:08 2011 (r218365) @@ -3448,10 +3448,17 @@ locate_dependency(const Obj_Entry *obj, } for (needed = obj->needed; needed != NULL; needed = needed->next) { - if (needed->obj == NULL) - continue; - if (object_match_name(needed->obj, name)) - return needed->obj; + if (strcmp(obj->strtab + needed->name, name) == 0 || + (needed->obj != NULL && object_match_name(needed->obj, name))) { + /* + * If there is DT_NEEDED for the name we are looking for, + * we are all set. Note that object might not be found if + * dependency was not loaded yet, so the function can + * return NULL here. This is expected and handled + * properly by the caller. + */ + return (needed->obj); + } } _rtld_error("%s: Unexpected inconsistency: dependency %s not found", obj->path, name); @@ -3577,6 +3584,8 @@ rtld_verify_object_versions(Obj_Entry *o vn = obj->verneed; while (vn != NULL) { depobj = locate_dependency(obj, obj->strtab + vn->vn_file); + if (depobj == NULL) + return (-1); vna = (const Elf_Vernaux *) ((char *)vn + vn->vn_aux); for (;;) { if (check_object_provided_version(obj, depobj, vna))