This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for default version and archive


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.

-- 
H.J. Lu (hjl@valinux.com)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]