[svlug] packages v. tarballs (was manners)

Joey Hess joey at kitenet.net
Sat Jun 30 22:31:01 PDT 2001


Joey Hess wrote:
> Rick Moen wrote:
> > I vaguely recall that the whole purpose of those major and minor
> > numbers, and the symlinks that implement them, is to be able to specify 
> > that an application is finicky enough to require a specific minor
> > number, or alternatively that it expects to be able to live with any lib
> > in that major-number family.
> 
> Welp, find some code in ld-linux.so that does that, or show me a behavior
> of it that implies that it tries to parse sonames for version info, I don't
> think you will, though.

This is interesting. The old ld.so (for libc5) appears to have some code
to compare some kind of minor versions, and just print a warning if
there is a mismatch between the wanted minor and the available minor. It
seems to be based on simple bit masks:

#define VMAJOR(x) (((x) & MAJOR_MASK) >> 16)
#define VMINOR(x) (((x) & MINOR_MASK) / 100)
#define VPATCH(x) (((x) & MINOR_MASK) % 100)

static int
incompatible(int in_core, int linked)
{
    return (VMAJOR(in_core) == VMAJOR(linked))
        ? ((VMINOR(in_core) >= VMINOR(linked))
           ? TOTAL_COMPATIBLE : MAJOR_COMPATIBLE)
            : NOT_COMPATIBLE;
}

This is not using the soname, but is looking at a numeric ELF field
called the NOTE_ABI field (I think). Interesting.

Glibc's dynamic loader seems to do nothing of the sort though. Instead,
just:

match_version (const char *string, struct link_map *map)
...
      /* Compare the version strings.  */
      if (strcmp (string, strtab + aux->vda_name) == 0)
        /* Bingo!  */

Which is, I think, the behavior I was describing earlier.

-- 
see shy jo




More information about the svlug mailing list