diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index a42f6d5390..0245f76799 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -66,8 +66,7 @@ check_match (const char *const undef_name,
 	     const Elf_Symndx symidx,
 	     const char *const strtab,
 	     const struct link_map *const map,
-	     const ElfW(Sym) **const versioned_sym,
-	     int *const num_versions)
+	     const ElfW(Sym) **const versioned_sym)
 {
   unsigned int stt = ELFW(ST_TYPE) (sym->st_info);
   assert (ELF_RTYPE_CLASS_PLT == 1);
@@ -92,6 +91,9 @@ check_match (const char *const undef_name,
     return NULL;
 
   const ElfW(Half) *verstab = map->l_versyms;
+  /* If the object is versioned, the linker ensures that either there is a
+     VER_NDX_GLOBAL definition or there are a few version index>=2 definitions,
+     with at most one being the default version. */
   if (version != NULL)
     {
       if (__glibc_unlikely (verstab == NULL))
@@ -124,33 +126,22 @@ check_match (const char *const undef_name,
     }
   else
     {
-      /* No specific version is selected.  There are two ways we
-	 can got here:
+      /* Looking for an unversioned symbol.  If the object is unversioned or
+	 there is a VER_NDX_GLOBAL definition, return sym.  Otherwise:
 
-	 - a binary which does not include versioning information
-	 is loaded
+	 If DL_LOOKUP_RETURN_NEWEST is set, return the default version if
+	 exists.
 
-	 - dlsym() instead of dlvsym() is used to get a symbol which
-	 might exist in more than one form
-
-	 If the library does not provide symbol version information
-	 there is no problem at all: we simply use the symbol if it
-	 is defined.
-
-	 These two lookups need to be handled differently if the
-	 library defines versions.  In the case of the old
-	 unversioned application the oldest (default) version
-	 should be used.  In case of a dlsym() call the latest and
-	 public interface should be returned.  */
+	 If DL_LOOKUP_RETURN_NEWEST is unset, return the index 2 definition if
+	 exists, otherwise return the default version if exists.  When the
+	 object became versioned, the original unversioned definition may take
+	 index 2.  */
       if (verstab != NULL)
 	{
 	  if ((verstab[symidx] & 0x7fff)
 	      >= ((flags & DL_LOOKUP_RETURN_NEWEST) ? 2 : 3))
 	    {
-	      /* Don't accept hidden symbols.  */
-	      if ((verstab[symidx] & 0x8000) == 0
-		  && (*num_versions)++ == 0)
-		/* No version so far.  */
+	      if ((verstab[symidx] & 0x8000) == 0)
 		*versioned_sym = sym;
 
 	      return NULL;
@@ -381,7 +372,6 @@ do_lookup_x (const char *undef_name, unsigned int new_hash,
 	continue;
 
       Elf_Symndx symidx;
-      int num_versions = 0;
       const ElfW(Sym) *versioned_sym = NULL;
 
       /* The tables for this map.  */
@@ -415,8 +405,7 @@ do_lookup_x (const char *undef_name, unsigned int new_hash,
 			symidx = ELF_MACHINE_HASH_SYMIDX (map, hasharr);
 			sym = check_match (undef_name, ref, version, flags,
 					   type_class, &symtab[symidx], symidx,
-					   strtab, map, &versioned_sym,
-					   &num_versions);
+					   strtab, map, &versioned_sym);
 			if (sym != NULL)
 			  goto found_it;
 		      }
@@ -440,18 +429,17 @@ do_lookup_x (const char *undef_name, unsigned int new_hash,
 	    {
 	      sym = check_match (undef_name, ref, version, flags,
 				 type_class, &symtab[symidx], symidx,
-				 strtab, map, &versioned_sym,
-				 &num_versions);
+				 strtab, map, &versioned_sym);
 	      if (sym != NULL)
 		goto found_it;
 	    }
 	}
 
-      /* If we have seen exactly one versioned symbol while we are
-	 looking for an unversioned symbol and the version is not the
-	 default version we still accept this symbol since there are
-	 no possible ambiguities.  */
-      sym = num_versions == 1 ? versioned_sym : NULL;
+      /* When looking for an unversioned symbol, a default version is a fallback
+	 when VER_NDX_GLOBAL is absent (and when DL_LOOKUP_RETURN_NEWEST is set,
+	 index 2 is also absent).  We don't repeat the check ensured by the
+	 linker: a symbol name has at most one default version.  */
+      sym = versioned_sym;
 
       if (sym != NULL)
 	{
