about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-open.c2
-rw-r--r--elf/dl-version.c56
-rw-r--r--elf/rtld.c4
3 files changed, 35 insertions, 27 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 15ed24fff2..94677590fe 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -147,7 +147,7 @@ dl_open_worker (void *a)
   _dl_map_object_deps (new, NULL, 0, 0);
 
   /* So far, so good.  Now check the versions.  */
-  (void) _dl_check_all_versions (new, 0);
+  (void) _dl_check_all_versions (new, 0, 0);
 
 #ifdef SCOPE_DEBUG
   show_scope (new);
diff --git a/elf/dl-version.c b/elf/dl-version.c
index 59e8dd33c8..94eaed88b2 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -160,7 +160,7 @@ no version information available (required by ",
 
 int
 internal_function
-_dl_check_map_versions (struct link_map *map, int verbose)
+_dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
 {
   int result = 0;
   const char *strtab;
@@ -209,29 +209,34 @@ _dl_check_map_versions (struct link_map *map, int verbose)
 	     and no stub entry was created.  This should never happen.  */
 	  assert (needed != NULL);
 
-	  /* NEEDED is the map for the file we need.  Now look for the
-	     dependency symbols.  */
-	  aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux);
-	  while (1)
+	  /* Make sure this is no stub we created because of a missing
+	     dependency.  */
+	  if (! trace_mode || needed->l_opencount != 0)
 	    {
-	      /* Match the symbol.  */
-	      result |= match_symbol ((*map->l_name
-				       ? map->l_name : _dl_argv[0]),
-				      aux->vna_hash,
-				      strtab + aux->vna_name,
-				      needed, verbose,
-				      aux->vna_flags & VER_FLG_WEAK);
-
-	      /* Compare the version index.  */
-	      if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high)
-		ndx_high = aux->vna_other & 0x7fff;
-
-	      if (aux->vna_next == 0)
-		/* No more symbols.  */
-		break;
-
-	      /* Next symbol.  */
-	      aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next);
+	      /* NEEDED is the map for the file we need.  Now look for the
+		 dependency symbols.  */
+	      aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux);
+	      while (1)
+		{
+		  /* Match the symbol.  */
+		  result |= match_symbol ((*map->l_name
+					   ? map->l_name : _dl_argv[0]),
+					  aux->vna_hash,
+					  strtab + aux->vna_name,
+					  needed, verbose,
+					  aux->vna_flags & VER_FLG_WEAK);
+
+		  /* Compare the version index.  */
+		  if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high)
+		    ndx_high = aux->vna_other & 0x7fff;
+
+		  if (aux->vna_next == 0)
+		    /* No more symbols.  */
+		    break;
+
+		  /* Next symbol.  */
+		  aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next);
+		}
 	    }
 
 	  if (ent->vn_next == 0)
@@ -356,13 +361,14 @@ _dl_check_map_versions (struct link_map *map, int verbose)
 
 int
 internal_function
-_dl_check_all_versions (struct link_map *map, int verbose)
+_dl_check_all_versions (struct link_map *map, int verbose, int trace_mode)
 {
   struct link_map *l;
   int result = 0;
 
   for (l = map; l != NULL; l = l->l_next)
-    result |= l->l_opencount != 0 && _dl_check_map_versions (l, verbose);
+    result |= (l->l_opencount != 0
+	       && _dl_check_map_versions (l, verbose, trace_mode));
 
   return result;
 }
diff --git a/elf/rtld.c b/elf/rtld.c
index 24968f87cd..7e960348f0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -283,6 +283,7 @@ struct map_args
 struct version_check_args
 {
   int doexit;
+  int dotrace;
 };
 
 static void
@@ -305,7 +306,7 @@ static void
 version_check_doit (void *a)
 {
   struct version_check_args *args = (struct version_check_args *) a;
-  if (_dl_check_all_versions (_dl_loaded, 1) && args->doexit)
+  if (_dl_check_all_versions (_dl_loaded, 1, args->dotrace) && args->doexit)
     /* We cannot start the application.  Abort now.  */
     _exit (1);
 }
@@ -842,6 +843,7 @@ of this helper program; chances are you did not intend to run this program.\n\
   {
     struct version_check_args args;
     args.doexit = mode == normal;
+    args.dotrace = mode == trace;
     _dl_receive_error (print_missing_version, version_check_doit, &args);
   }