PATCH: A symbol version bug
H. J. Lu
hjl@lucon.org
Thu May 15 16:33:00 GMT 2003
On Thu, May 15, 2003 at 02:39:44AM -0400, Jack Howarth wrote:
> HJ,
> I am able to build glibc cvs (without the base patch) using a
> stock debian binutils 2.14.90.0.1 (without the bfd-base patch).
> The resulting glibc passes make check fine (and vismain.out in
> particular). So it seems to me that we may need binutils cvs
> for these two patches to work. Could you roll a test binutils
> release from current binutils cvs? I'll test that tomorrow
> using both of the patches again to see if the vismain.out test
> still fails. Thanks in advance.
Ooops. Here is the new symbol version patch. Please try this one.
H.J.
-------------- next part --------------
2003-05-15 <hongjiu.lu@intel.com>
* elf/do-lookup.h (FCT): Try the base version, the first
version and then the default version, in that order, for
the old unversioned reference.
--- elf/do-lookup.h.base 2003-05-15 09:29:25.000000000 -0700
+++ elf/do-lookup.h 2003-05-15 09:24:24.000000000 -0700
@@ -52,7 +52,8 @@ FCT (const char *undef_name, unsigned lo
const ElfW(Sym) *sym;
#if ! VERSIONED
int num_versions = 0;
- const ElfW(Sym) *versioned_sym = NULL;
+ const ElfW(Sym) *default_version = NULL;
+ const ElfW(Sym) *first_version = NULL;
#endif
map = list[i];
@@ -155,16 +156,29 @@ FCT (const char *undef_name, unsigned lo
public interface should be returned. */
if (verstab != NULL)
{
- if ((verstab[symidx] & 0x7fff)
- >= ((flags & DL_LOOKUP_RETURN_NEWEST) ? 2 : 3))
+ ElfW(Half) ndx = verstab[symidx] & 0x7fff;
+ if (ndx >= ((flags & DL_LOOKUP_RETURN_NEWEST) ? 2 : 3))
{
/* Don't accept hidden symbols. */
if ((verstab[symidx] & 0x8000) == 0 && num_versions++ == 0)
/* No version so far. */
- versioned_sym = sym;
+ default_version = sym;
continue;
}
+ if ((flags & DL_LOOKUP_RETURN_NEWEST) == 0 && ndx != 0)
+ {
+ /* ndx == 1 is the base version. We will use it for
+ old unversioned application. */
+ if (ndx != 1)
+ {
+ /* We remember the first version and keep looking
+ for the base version. */
+ if (ndx == 2)
+ first_version = sym;
+ continue;
+ }
+ }
}
#endif
@@ -179,7 +193,8 @@ FCT (const char *undef_name, unsigned lo
#if VERSIONED
sym = NULL;
#else
- sym = num_versions == 1 ? versioned_sym : NULL;
+ sym = first_version ?: (num_versions == 1
+ ? default_version : NULL);
#endif
if (sym != NULL)
More information about the Libc-alpha
mailing list