[Gábor Gombás] Bug#564566: libkadm5clnt7: SONAME conflict with Heimdal

Nicolas Williams Nicolas.Williams at sun.com
Mon Jan 11 14:14:59 EST 2010

On Mon, Jan 11, 2010 at 01:18:45PM -0500, Tom Yu wrote:
> Nicolas Williams <Nicolas.Williams at sun.com> writes:
> > I believe the Solaris RTLD indexes a running process' link map by
> > SONAME.  If two objects have the same SONAME then only one will be
> > loaded, regardless of -B group/local or RTLD_GROUP/LOCAL use.
> So the RTLD doesn't index by device+inode, etc.?

I've heard back from the linker folks:

|The SONAME is a convenience for recording a dependency by
|a name, no matter how ld(1) found the object.
|But, ld.so.1 thinks of objects by dev/inode.  Thus you can
|have two different libfoo's, presumably with the same SONAME,
|in different dirs, and you can bring both of them into a process.
|Note that direct bindings allows different objects to bind to
|each instance.  RTLD_GROUP is a poor mans direct binding model :-)
|Without direct bindings, and given each object exports the same
|interfaces, the process would normally bind to the first instance
|loaded as it would effectively interpose on the latter.

In other words, if you take care (i.e., use -B direct, available only in
Solaris), you can load two different objects with the same SONAME, but
the default behavior is to load just one.  I think the Linux behavior
matches the Solaris default (Linux does pre-linking instead of direct

The ld(1) manpage says:

     -h name
     --soname name

         In dynamic mode only, when  building  a  shared  object,
         records  name  in  the object's dynamic section. name is
         recorded in any dynamic objects  that  are  linked  with
         this  object  rather than the object's file system name.
         Accordingly, name is used by the runtime linker  as  the
         name  of the shared object to search for at runtime. See
         Recording a Shared Object Name in Linker  and  Libraries

The key: "Accordingly, name is used [...] to search for at runtime."

Also, from dlopen(3C):

            Any object of mode RTLD_LOCAL that is referenced as a
     dependency  of  an object of mode RTLD_GLOBAL is promoted to
     RTLD_GLOBAL. In other words, the RTLD_LOCAL mode is ignored.

I.e., the RTLD loads objects once.

[A pair of dlopen() alls, each of a different object, both with the same
SONAME might load both objects.  I'm not sure about that.  But that's
not the issue here.]

> I think this is starting to get sufficiently far into the fringe of
> viable portability that I would be more comfortable with a "different
> SONAMEs" solution.

I agree.


More information about the krbdev mailing list