cvs commit: src/lib/libc Versions.def

Alexander Kabaev kabaev at gmail.com
Thu May 8 18:45:48 UTC 2008


On Thu, 8 May 2008 01:55:32 -0400 (EDT)
Daniel Eischen <deischen at freebsd.org> wrote:

> On Wed, 7 May 2008, Jason Evans wrote:
> 
> > Alexander Kabaev wrote:
> >> kan         2008-05-07 15:39:34 UTC
> >>
> >>   FreeBSD src repository
> >>
> >>   Modified files:
> >>     lib/libc             Versions.def   Log:
> >>   Keep versions on a dependency chain to exclude even remote
> >> possiblity of private version ever getting index 2.
> >
> > Why is this the right thing to do?  Clearly FBSDprivate_1.0 should
> > never be incremented, but it does not make sense to me to have it
> > depend on any other version.  In the absence of a compelling
> > argument, I am of the opinion that Dan Eischen made a good change.
> > Did you discuss this issue with him?
> 
> I think it has more to do with how rtld works, though I don't
> know the details.  You can see that kan made this same exact
> change in rev 1.3 of Versions.def.  So in actuality, I backed
> kan's change out thinking that I had originally committed it
> that way.
> -- 
> DE

rtld magically expects version with verndx 2 to be the oldest version
applied to the shared library. It uses this to resolve symbols for
old unversioned binaries that happen to run against the versioned
library. Having FBSDPrivate to be a root of its own depenency tree can
potentionally cause linker to assign it version #2 instead of FBSD_1.0,
breaking old binaries. Keeping all versions in a dependency chain
rooted at FBSD_1.0 is a simple way to avoid the breakage.

In general, 'dependency' in version strings is useless and people
should read too much into it. Nor should they apply their
object-oriented language concepts while looking at what version
inherits from what other version.

> 
> FYI, before I commited this change, I looked at how glibc did it.
> Their private namespace does not inherit from the GLIBC public
> namespace.  But perhaps they have other ways of preventing
> exactly what kan is trying to avoid.
> 
You looked at sources, I guess, not what gets generated after they run
their AWK script on it.

$ readelf -V /compat/linux/lib/libc-2.3.6.so
...
Version definition section '.gnu.version_d' contains 18 entries:
  Addr: 0x0000000000011b40  Offset: 0x011b40  Link: 4 (.dynstr)
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: libc.so.6
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: GLIBC_2.0
  0x0038: Rev: 1  Flags: none  Index: 3  Cnt: 2  Name: GLIBC_2.1
  0x0054: Parent 1: GLIBC_2.0
...
  0x0230: Rev: 1  Flags: none  Index: 17  Cnt: 2  Name: GLIBC_PRIVATE
  0x024c: Parent 1: GLIBC_2.3.4

-- 
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20080508/cceab6aa/signature.pgp


More information about the cvs-src mailing list