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

Nicolas Williams Nicolas.Williams at sun.com
Mon Jan 11 17:01:33 EST 2010


On Mon, Jan 11, 2010 at 01:14:59PM -0600, Nicolas Williams wrote:
> I've heard back from the linker folks:

A bit more:

|> My question was rather different, though Rod mostly answered it.  The
|> question is: if two objects link with two different libraries with the
|> same soname, what will happen when those two objects are loaded (by
|> dlopen() or otherwise) into the same process?
|>
|> A concrete example:
|>
|> % cc -G -Kpic -o libfoo1.so -h libfoo.so.1 foo1.c
|> % cc -G -Kpic -o libfoo2.so -h libfoo.so.1 foo2.c
|> % cc -G -Kpic -o libbar1.so bar1.c -lfoo1
|> % cc -G -Kpic -o libbar2.so bar2.c -lfoo2
|> % cc -o foobar foobar.c -lbar1 -lbar2
|
|libbar1.so will record a dependency (NEEDED) of libfoo.so.1, as this is
|the SONAME of the library, libfoo1.so, that was referenced.  libbar2.so
|will also recorded a dependency (NEEDED) of libfoo.so.1, as this is
|the SONAME of the library, libfoo2.so, that was referenced.
|
|ld.so.1 will use the default library search path to find libfoo1.so.
|
|libfoo1.so will be loaded, and will resolve the NEEDED of each caller.
|
|
|> Another:
|>
|> % cc -G -Kpic -o /tmp/dir1/libfoo.so -h libfoo.so.1 foo1.c
|> % cc -G -Kpic -o /tmp/dir2/libfoo.so -h libfoo.so.1 foo2.c
|> % cc -G -Kpic -o libbar1.so bar1.c -L/tmp/dir1 -lfoo1 -R/tmp/dir1
|> % cc -G -Kpic -o libbar2.so bar2.c -L/tmp/dir2 -lfoo2 -R/tmp/dir2
|> % cc -o foobar foobar.c -lbar1 -lbar2
|
|libbar1.so. will load /tmp/dir1/libfoo.so (as directed by it's
|NEEDED requirements and RUNPATH use).
|
|libbar2.so. will load /tmp/dir2/libfoo.so (as directed by it's
|NEEDED requirements and RUNPATH use).

So the RTLD does use a combination of SONAME and search path to decide
object will be used.

Rod also points to a useful blog entry of his:

|http://blogs.sun.com/rie/entry/loading_multiple_files_same_name

SONAME conflicts can be dealt with, at least on Solaris by using direct
binding.  I'm not sure that they can be dealt with on Linux as easily.

IMO it's better to just avoid SONAME conflicts.

Nico
-- 



More information about the krbdev mailing list