soname and symbol versions in private libs

tridge at samba.org tridge at samba.org
Sun Jan 16 23:32:30 MST 2011


Hi Metze,

Sorry its taken me so long to get back to you on this.

I've written a little test script that tests the following two
scenarios:

 - an application that accesses a library directly, and also
   indirectly via a module
 - the application is linked to a 'public' version of the library
 - the module is linked to a different 'private' version of the
   library
 - the application accesses a static pointer in the library both via
   the direct public library and indirectly via the module
 - the application can be optionally built to require access to a new
   symbol in the private version of the library that is not in the
   public version of the library

This is a simulation of the situation with talloc and other libraries
that we are concerned about.

The script tests the following combinations:

 - both the soname and symbol versions being different between the private
   and public libraries
 - the soname matching, but the symbol versions different between the
   two libraries
 - the symbol versions matching, but the soname different between the
   two libraries
 - the soname and the symbol versions matching between the two
   libraries

The script defines "correct" behaviour as not exposing two different
versions of the same static pointer in the same application. It is
considered acceptable to either run fine with the application getting
the same static pointer both times, or with it failing to load the
module due to symbols not being able to be resolved if the module
needs the new symbol. In other words "do the right thing, and if you
can't do that, then fail to load".

The results on my Ubuntu Maverick box are:

when the module doesn't need a new symbol:

  both different: ERROR: returns different pointers
  symbol version different, soname same: ERROR: fails to load module
  symbol version same, soname different: ERROR: returns different pointers
  both same: OK: uses same library

when the module does need a new symbol:

  both different: ERROR: returns different pointers
  symbol version different, soname same: OK: fails to load module that depends on new symbol
  symbol version same, soname different: ERROR: returns different pointers
  both same: OK: fails to load module that depends on new symbol

The test is in the shlib directory in junkcode:

  http://git.samba.org/?p=tridge/junkcode.git;a=tree;f=shlib;



More information about the samba-technical mailing list