A patch for binutils (Re: the setrlimit changes in glibc 2.1.3)
H . J . Lu
hjl@lucon.org
Thu Jan 13 12:47:00 GMT 2000
On Thu, Jan 13, 2000 at 03:21:29PM -0500, Ian Lance Taylor wrote:
> Date: Thu, 13 Jan 2000 11:23:31 -0800
> From: "H . J . Lu" <hjl@lucon.org>
>
> Thanks. Here is a patch for binutils 2.9.5.0.22. Ian, what do you
> think?
>
> Thu Jan 13 11:03:29 2000 H.J. Lu <hjl@gnu.org>
>
> * elflink.h (elf_link_add_object_symbols): Bound the external
> references to the default version to the hidden version.
>
> There is something odd about this case. libtest.so has an external
> reference to symbol foo in version FOO_1.0. Why are we looking up
> foo@@FOO_1.0? Why aren't we looking up foo@FOO_1.0? If I understand
It is because libtest.so is linked against the older libfoo.so,
libfoo.so.1.0, where the FOO_1.0 of foo is the default. You got the
reference to foo@@FOO_1.0. The new libfoo.so, libfoo.so.1.1, has
the FOO_1.1 of foo as default and foo@FOO_1.0 is hidden.
> your patch, the latter is defined while the former is not. That also
> matches my intuition.
>
> We use the double @ to indicate the default version of a symbol. But
> that is only applicable to a definition. It does not make sense to
> refer to the default version of a symbol and to simultaneously specify
> a specific version. When we do use the double @, we also set up a
> reference from the unqualified symbol name, and from the symbol name
> with a single @.
Please remember a specific version may change from default to hidden.
However, foo@FOO_1.0 will always be 100 binary compatible with
foo@@FOO_1.0.
>
> So I suspect that your patch, which sets up an indirection from
> foo@@FOO_1.0 to foo@FOO_1.0, is fixing the wrong thing. We should be
> asking why there would ever be a reference to foo@@FOO_1.0.
>
> Perhaps the fix is as simple as changing the code to not add a second
> ELF_VER_CHR if sym.st_shndx is SHN_UNDEF.
>
You are right. Here is the new patch. Please ignore my previous one.
Thanks.
H.J.
--
Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.14
diff -u -p -r1.14 elflink.h
--- elflink.h 1999/11/01 22:47:51 1.14
+++ elflink.h 2000/01/13 20:45:07
@@ -1293,7 +1442,13 @@ elf_link_add_object_symbols (abfd, info)
strcpy (newname, name);
p = newname + namelen;
*p++ = ELF_VER_CHR;
- if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
+ /* For the undefined versioned symbol, we always
+ reference the hidden version. The default version
+ will resolve the reference to the hidden one. It
+ solves the problem where a version changes from
+ default to higgen. */
+ if ((iver.vs_vers & VERSYM_HIDDEN) == 0
+ && sym.st_shndx != SHN_UNDEF)
*p++ = ELF_VER_CHR;
strcpy (p, verstr);
More information about the Libc-hacker
mailing list