about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-lookup.c8
-rw-r--r--elf/dl-version.c1
-rw-r--r--elf/dlvsym.c1
-rw-r--r--elf/link.h1
4 files changed, 8 insertions, 3 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 15da23d95c..4cc1f2d468 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -151,10 +151,12 @@ do_lookup (const char *undef_name, unsigned long int hash,
 		}
 	      else
 		{
-		  /* We can match the version information.  */
+		  /* We can match the version information or use the
+		     default one.  */
 		  ElfW(Half) ndx = verstab[symidx] & 0x7fff;
-		  if (map->l_versions[ndx].hash != version->hash
-		      || strcmp (map->l_versions[ndx].name, version->name))
+		  if ((map->l_versions[ndx].hash != version->hash
+		       || strcmp (map->l_versions[ndx].name, version->name))
+		      && (version->hidden || map->l_versions[ndx].hash))
 		    /* It's not the version we want.  */
 		    continue;
 		}
diff --git a/elf/dl-version.c b/elf/dl-version.c
index f7df9805b3..d06fd5ce1e 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -274,6 +274,7 @@ _dl_check_map_versions (struct link_map *map, int verbose)
 		    {
 		      ElfW(Half) ndx = aux->vna_other & 0x7fff;
 		      map->l_versions[ndx].hash = aux->vna_hash;
+		      map->l_versions[ndx].hidden = aux->vna_other & 0x8000;
 		      map->l_versions[ndx].name = &strtab[aux->vna_name];
 		      map->l_versions[ndx].filename = &strtab[ent->vn_file];
 
diff --git a/elf/dlvsym.c b/elf/dlvsym.c
index ca8e25d9df..18cb892a3f 100644
--- a/elf/dlvsym.c
+++ b/elf/dlvsym.c
@@ -95,6 +95,7 @@ __dlvsym (void *handle, const char *name, const char *version_str)
 
   /* Compute hash value to the version string.  */
   args.version.name = version_str;
+  args.version.hidden = 1;
   args.version.hash = _dl_elf_hash (version_str);
   /* We don't have a specific file where the symbol can be found.  */
   args.version.filename = NULL;
diff --git a/elf/link.h b/elf/link.h
index 6c272fe054..20e80b1466 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -87,6 +87,7 @@ struct r_found_version
     const char *name;
     ElfW(Word) hash;
 
+    int hidden;
     const char *filename;
   };