PATCH: A symbol version bug

H. J. Lu hjl@lucon.org
Wed May 14 15:33:00 GMT 2003


On Tue, May 13, 2003 at 05:50:53PM -0700, H. J. Lu wrote:
> On Tue, May 13, 2003 at 05:20:26PM -0700, H. J. Lu wrote:
> > Michael found a bug between binutils and glibc. ld.so assumes the
> > first symbol from the hash table is the oldest (default) version.
> > Unfortunately, it is not always true. The question is if glibc
> > should depend on it or ld should guarantee it.
> > 
> > 
> 
> There are one glibc bug and one binutils bug. Both should take base
> version into account.

Here is the patch for binutils.


H.J.
-------------- next part --------------
2003-05-14  H.J. Lu <hongjiu.lu@intel.com>

	* elflink.h (elf_link_check_versioned_symbol): Also allow
	the base version.

--- bfd/elflink.h.base	2003-05-09 08:13:31.000000000 -0700
+++ bfd/elflink.h	2003-05-14 08:30:10.000000000 -0700
@@ -4334,6 +4334,7 @@ elf_link_check_versioned_symbol (info, h
 	{
 	  const char *name;
 	  Elf_Internal_Versym iver;
+	  unsigned short version_index;
 
 	  if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
 	      || isym->st_shndx == SHN_UNDEF)
@@ -4354,9 +4355,10 @@ elf_link_check_versioned_symbol (info, h
 	      abort ();
 	    }
 
-	  if ((iver.vs_vers & VERSYM_VERSION) == 2)
+	  version_index = iver.vs_vers & VERSYM_VERSION;
+	  if (version_index == 1 || version_index == 2)
 	    {
-	      /* This is the oldest (default) sym.  We can use it.  */
+	      /* This is the base or first version.  We can use it.  */
 	      free (extversym);
 	      free (isymbuf);
 	      return TRUE;


More information about the Binutils mailing list