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
Date: Mon, 20 Nov 2000 11:41:33 -0800
From: "H . J . Lu" <hjl@valinux.com>
On Mon, Nov 20, 2000 at 10:44:31AM -0800, Ian Lance Taylor wrote:
> Date: Sat, 18 Nov 2000 18:17:59 -0800
> From: "H . J . Lu" <hjl@valinux.com>
>
> Say you want to override "open" in libc.so:
>
> # objdump --dynamic-sym /lib/libc.so.6 | grep GLIBC| grep " open$"
> 000d8d80 w DF .text 00000040 GLIBC_2.0 open
> # objdump --dynamic-sym /usr/lib/lib*.so | grep GLIBC | grep " open$"
> .....
> 00000000 DF *UND* 0000003d GLIBC_2.0 open
>
> As you can see, many DSOs in /usr/lib have "open" bound to version
> "GLIBC_2.0". Since GLIBC_2.0 is the default version, by providing your
> own implementation of "open", all refereneces to "open" version
> "GLIBC_2.0" will be resolved to your "open" without version. That is
> exactly what happens if there is no symbol versioning.
>
> Yes, but those references to open were written as references to open,
> not as references to open version GLIBC_2.0. The program linker added
See
00000000 DF *UND* 0000003d GLIBC_2.0 open
^^^^^^^^^
"open" IS bound to "open" with vesion "GLIBC_2.0". That is how symbol
versioning works. Later, if we want to introduce a new "open", say
open () with O_LARGEFILE by default, we can make the new "open" with
version "GLIBC_2.3". But the reference of
00000000 DF *UND* 0000003d GLIBC_2.0 open
will be bound to "open" with vesion "GLIBC_2.0" if its definiton is
available, not the new default definiton of "open" with version
"GLIBC_2.3". Otherwise, you will get a run-time error.
Basically, every glibc symbol reference in a shared library built with
-lc is bound to a specific version. At the link time, some are bound to
a default vesioned definiton and some are bound to non-default vesioned
definiton. But at the run-time, they make no difference. They are all
bound to a specific version.
I believe that what we are discussing here is whether users should be
permitted to write references to specific versions in object files.
Here is what I wrote, quoted above: ``Yes, but those references to
open were written as references to open, not as references to open
version GLIBC_2.0.''
I don't see anything in what you wrote that responds to what I said.
I agree that what you say is true. But I don't see why it is
relevant. If you find what I wrote to be unclear, please let me know
and I will try to clarify it.
Ian