about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-26 05:55:17 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-26 05:55:17 +0000
commit697119d670d6ec1283fff84eccf405a4851e83a6 (patch)
treed66e57b656a074b0f5297eb2ccd5aa94febf7eff
parent42374865bc5e53253f96191db3c2778f78fe26f8 (diff)
downloadglibc-697119d670d6ec1283fff84eccf405a4851e83a6.tar.gz
glibc-697119d670d6ec1283fff84eccf405a4851e83a6.tar.xz
glibc-697119d670d6ec1283fff84eccf405a4851e83a6.zip
Update.
2003-03-25  H.J. Lu  <hjl@gnu.org>

	* elf/dl-lookup.c (_dl_lookup_symbol): Avoid looking up protected
	symbols twice.
	(_dl_lookup_versioned_symbol): Likewise.
-rw-r--r--ChangeLog6
-rw-r--r--elf/dl-lookup.c68
2 files changed, 53 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 0de4810111..e849b38d0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-25  H.J. Lu  <hjl@gnu.org>
+
+	* elf/dl-lookup.c (_dl_lookup_symbol): Avoid looking up protected
+	symbols twice.
+	(_dl_lookup_versioned_symbol): Likewise.
+
 2003-03-26  Jakub Jelinek  <jakub@redhat.com>
 
 	* csu/tst-atomic.c (do_test): Add some new
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 4603761383..2b7473662f 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -273,17 +273,30 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
     {
       /* It is very tricky.  We need to figure out what value to
          return for the protected symbol.  */
-      struct sym_val protected_value = { NULL, NULL };
-
-      for (scope = symbol_scope; *scope; ++scope)
-	if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope,
-			   0, flags, NULL, ELF_RTYPE_CLASS_PLT))
-	  break;
-
-      if (protected_value.s != NULL && protected_value.m != undef_map)
+      if (type_class == ELF_RTYPE_CLASS_PLT)
 	{
-	  current_value.s = *ref;
-	  current_value.m = undef_map;
+	  if (current_value.s != NULL && current_value.m != undef_map)
+	    {
+	      current_value.s = *ref;
+	      current_value.m = undef_map;
+	    }
+	}
+      else
+	{
+	  struct sym_val protected_value = { NULL, NULL };
+
+	  for (scope = symbol_scope; *scope; ++scope)
+	    if (_dl_do_lookup (undef_name, hash, *ref,
+			       &protected_value, *scope, 0, flags,
+			       NULL, ELF_RTYPE_CLASS_PLT))
+	      break;
+
+	  if (protected_value.s != NULL
+	      && protected_value.m != undef_map)
+	    {
+	      current_value.s = *ref;
+	      current_value.m = undef_map;
+	    }
 	}
     }
 
@@ -465,18 +478,31 @@ _dl_lookup_versioned_symbol (const char *undef_name,
     {
       /* It is very tricky.  We need to figure out what value to
          return for the protected symbol.  */
-      struct sym_val protected_value = { NULL, NULL };
-
-      for (scope = symbol_scope; *scope; ++scope)
-	if (_dl_do_lookup_versioned (undef_name, hash, *ref, &protected_value,
-				     *scope, 0, version, NULL,
-				     ELF_RTYPE_CLASS_PLT))
-	  break;
-
-      if (protected_value.s != NULL && protected_value.m != undef_map)
+      if (type_class == ELF_RTYPE_CLASS_PLT)
 	{
-	  current_value.s = *ref;
-	  current_value.m = undef_map;
+	  if (current_value.s != NULL && current_value.m != undef_map)
+	    {
+	      current_value.s = *ref;
+	      current_value.m = undef_map;
+	    }
+	}
+      else
+	{
+	  struct sym_val protected_value = { NULL, NULL };
+
+	  for (scope = symbol_scope; *scope; ++scope)
+	    if (_dl_do_lookup_versioned (undef_name, hash, *ref,
+					 &protected_value,
+					 *scope, 0, version, NULL,
+					 ELF_RTYPE_CLASS_PLT))
+	      break;
+
+	  if (protected_value.s != NULL
+	      && protected_value.m != undef_map)
+	    {
+	      current_value.s = *ref;
+	      current_value.m = undef_map;
+	    }
 	}
     }