Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Feb 2011 09:33:08 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218365 - stable/8/libexec/rtld-elf
Message-ID:  <201102060933.p169X8IZ058840@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))



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