This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: A patch for default version and archive
On Tue, Nov 14, 2000 at 09:49:50AM -0800, Ian Lance Taylor wrote:
> Date: Tue, 14 Nov 2000 09:33:16 -0800
> From: "H . J . Lu" <hjl@valinux.com>
>
> On Tue, Nov 14, 2000 at 08:59:06AM -0800, Ian Lance Taylor wrote:
> >
> > What I think we really need to do is to write down the semantics of
> > versioned symbols. I actually asked Eric to do this long ago so that
> > I could understand what was going on, but he never found the time to
>
> I have added some documentations for .symver to as:
>
> Thanks for doing that. But I assume you understand that this has
> nothing to do with the written semantics of versioning that I would
> like to see. Your documentation assumes that the reader already
> understands versioning, and understands what the symbols with @ in
> their name represent. Those are among the questions I think ought to
> be answered.
>
I see your point. I left it out. Even Ulrich and I have different
interpretations of what the symbols with @ in their name represent :-).
Here is my take. As far as I know, symbol versioning was introduced to
solve one problem, that is to provide the backward compatibility when
the ABI in libc.so is changed. Since glibc 2.1 (?), when you do
# gcc x.c
# nm a.out| grep GLIBC
w __cxa_finalize@@GLIBC_2.1.3
w __deregister_frame_info@@GLIBC_2.0
U __libc_start_main@@GLIBC_2.0
w __register_frame_info@@GLIBC_2.0
U fclose@@GLIBC_2.1
U fopen@@GLIBC_2.1
U fprintf@@GLIBC_2.0
As you can see, each reference to symbols in libc.so are bound to a
specific version. Since we don't have symbol versioning in x.c, all
references are resolved to symbols with `@@', which are symbols can
resolve references to symbols with the same version or without any
version. Normally, you won't see any references to `@' since it will
only show up with my glibc proposal. However, you can do
# nm /lib/libc.so.6 | grep GLIBC
The one with `@@' will resolve references to symbols with the same
verison or without any version. The one with `@' will only resolve
references to symbols with the same verison. There 2 different cases
for the one with `@' like foo@ver1:
1. ld.so will resolve references to foo with version ver1. You can
image those references look like foo@ver1 or foo@@ver1.
2. ld will only resolve references to foo@ver1.
--
H.J. Lu (hjl@valinux.com)