about summary refs log tree commit diff
path: root/elf/do-lookup.h
diff options
context:
space:
mode:
Diffstat (limited to 'elf/do-lookup.h')
-rw-r--r--elf/do-lookup.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index 873e95322c..ffc98ab624 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -157,19 +157,23 @@ FCT (const char *undef_name, struct link_map *undef_map,
 	found_it:
 	  switch (ELFW(ST_BIND) (sym->st_info))
 	    {
+	    case STB_WEAK:
+	      /* Weak definition.  Use this value if we don't find another.  */
+	      if (__builtin_expect (_dl_dynamic_weak, 0))
+		{
+		  if (! result->s)
+		    {
+		      result->s = sym;
+		      result->m = map;
+		    }
+		  break;
+		}
+	      /* FALLTHROUGH */
 	    case STB_GLOBAL:
 	      /* Global definition.  Just what we need.  */
 	      result->s = sym;
 	      result->m = map;
 	      return 1;
-	    case STB_WEAK:
-	      /* Weak definition.  Use this value if we don't find another.  */
-	      if (! result->s)
-		{
-		  result->s = sym;
-		  result->m = map;
-		}
-	      break;
 	    default:
 	      /* Local symbols are ignored.  */
 	      break;