about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-04-15 06:37:43 +0000
committerUlrich Drepper <drepper@redhat.com>2002-04-15 06:37:43 +0000
commit78575a842bce4d8e8c725506da1f826d16b660eb (patch)
tree5167b04e3c2f195c79de8bb27d23194a88d78cc3 /elf
parentfab656f5a776f09596b9e74f9a43f8300dd724c7 (diff)
downloadglibc-78575a842bce4d8e8c725506da1f826d16b660eb.tar.gz
glibc-78575a842bce4d8e8c725506da1f826d16b660eb.tar.xz
glibc-78575a842bce4d8e8c725506da1f826d16b660eb.zip
Update.
2002-04-14  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-lookup.c (_dl_lookup_symbol): Move add_dependency call to
	the end of the function.  Pass original flags to recursive call if
	add_dependency failed.
	(_dl_lookup_versioned_symbol): Likewise.

2002-04-13  Jakub Jelinek  <jakub@redhat.com>

	* time/mktime.c (__mktime_internal): If year is 69, don't bail out
	early, but check whether it overflowed afterwards.
	* time/tst-mktime.c (main): Add new tests.

	* debug/xtrace.sh: Fix program name in help message.
	Patch by Roger Luethi <rl@hellgate.ch>.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-lookup.c83
1 files changed, 39 insertions, 44 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 9d1e1f65af..895b60df7d 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -228,24 +228,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
   for (scope = symbol_scope; *scope; ++scope)
     if (do_lookup (undef_name, hash, *ref, &current_value, *scope, 0, flags,
 		   NULL, type_class))
-      {
-	/* We have to check whether this would bind UNDEF_MAP to an object
-	   in the global scope which was dynamically loaded.  In this case
-	   we have to prevent the latter from being unloaded unless the
-	   UNDEF_MAP object is also unloaded.  */
-	if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
-	    /* Don't do this for explicit lookups as opposed to implicit
-	       runtime lookups.  */
-	    && (flags & DL_LOOKUP_ADD_DEPENDENCY) != 0
-	    /* Add UNDEF_MAP to the dependencies.  */
-	    && add_dependency (undef_map, current_value.m) < 0)
-	  /* Something went wrong.  Perhaps the object we tried to reference
-	     was just removed.  Try finding another definition.  */
-	  return INTUSE(_dl_lookup_symbol) (undef_name, undef_map, ref,
-					    symbol_scope, type_class, 0);
-
-	break;
-      }
+      break;
 
   if (__builtin_expect (current_value.s == NULL, 0))
     {
@@ -266,8 +249,8 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
   protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
   if (__builtin_expect (protected != 0, 0))
     {
-      /* It is very tricky. We need to figure out what value to
-         return for the protected symbol */
+      /* 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)
@@ -282,6 +265,21 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
 	}
     }
 
+  /* We have to check whether this would bind UNDEF_MAP to an object
+     in the global scope which was dynamically loaded.  In this case
+     we have to prevent the latter from being unloaded unless the
+     UNDEF_MAP object is also unloaded.  */
+  if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
+      /* Don't do this for explicit lookups as opposed to implicit
+	 runtime lookups.  */
+      && (flags & DL_LOOKUP_ADD_DEPENDENCY) != 0
+      /* Add UNDEF_MAP to the dependencies.  */
+      && add_dependency (undef_map, current_value.m) < 0)
+      /* Something went wrong.  Perhaps the object we tried to reference
+	 was just removed.  Try finding another definition.  */
+      return INTUSE(_dl_lookup_symbol) (undef_name, undef_map, ref,
+					symbol_scope, type_class, flags);
+
   if (__builtin_expect (GL(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
     _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope,
@@ -395,26 +393,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
       int res = do_lookup_versioned (undef_name, hash, *ref, &current_value,
 				     *scope, 0, version, NULL, type_class);
       if (res > 0)
-	{
-	  /* We have to check whether this would bind UNDEF_MAP to an object
-	     in the global scope which was dynamically loaded.  In this case
-	     we have to prevent the latter from being unloaded unless the
-	     UNDEF_MAP object is also unloaded.  */
-	  if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
-	      /* Don't do this for explicit lookups as opposed to implicit
-		 runtime lookups.  */
-	      && flags != 0
-	      /* Add UNDEF_MAP to the dependencies.  */
-	      && add_dependency (undef_map, current_value.m) < 0)
-	    /* Something went wrong.  Perhaps the object we tried to reference
-	       was just removed.  Try finding another definition.  */
-	    return INTUSE(_dl_lookup_versioned_symbol) (undef_name, undef_map,
-							ref, symbol_scope,
-							version, type_class,
-							0);
-
-	  break;
-	}
+	break;
 
       if (__builtin_expect (res, 0) < 0)
 	{
@@ -462,8 +441,8 @@ _dl_lookup_versioned_symbol (const char *undef_name,
 
   if (__builtin_expect (protected != 0, 0))
     {
-      /* It is very tricky. We need to figure out what value to
-         return for the protected symbol */
+      /* 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)
@@ -479,6 +458,22 @@ _dl_lookup_versioned_symbol (const char *undef_name,
 	}
     }
 
+  /* We have to check whether this would bind UNDEF_MAP to an object
+     in the global scope which was dynamically loaded.  In this case
+     we have to prevent the latter from being unloaded unless the
+     UNDEF_MAP object is also unloaded.  */
+  if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
+      /* Don't do this for explicit lookups as opposed to implicit
+	 runtime lookups.  */
+      && flags != 0
+      /* Add UNDEF_MAP to the dependencies.  */
+      && add_dependency (undef_map, current_value.m) < 0)
+      /* Something went wrong.  Perhaps the object we tried to reference
+	 was just removed.  Try finding another definition.  */
+      return INTUSE(_dl_lookup_versioned_symbol) (undef_name, undef_map,
+						  ref, symbol_scope,
+						  version, type_class, flags);
+
   if (__builtin_expect (GL(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
     _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope,
@@ -545,8 +540,8 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
 
   if (__builtin_expect (protected != 0, 0))
     {
-      /* It is very tricky. We need to figure out what value to
-         return for the protected symbol */
+      /* It is very tricky.  We need to figure out what value to
+         return for the protected symbol.  */
       struct sym_val protected_value = { NULL, NULL };
 
       if (i >= (*scope)->r_nlist