This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
dlopen, RTLD_LOCAL and identically named libraries
- From: Mark Boorer <markboo99 at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Thu, 28 Aug 2014 16:54:22 +0100
- Subject: dlopen, RTLD_LOCAL and identically named libraries
- Authentication-results: sourceware.org; auth=none
Hi,
I have a question regarding dlopen with RTLD_LOCAL and libraries with
identical names
I have two versions of a library with the same filename in separate
directories, and I have two separate "plugins", each linking to one
version of the library.
plugin1.so -> library1/library.so
plugin2.so -> library2/library.so
The path to library.so is baked into the RPATH of each plugin, so when
ran independently, they each call the correct functions. However, when
I load both plugins one after the other (with RTLD_NOW | RTLD_LOCAL) ,
only the first version of library.so is used.
The behaviour is the same if the two versions of library.so share an
soname as well. It seems as though the basename of the library (or the
soname) is checked at a global level.
I would expect that behaviour if library.so was already linked in the
global scope, but in my case it is not.
Is this the intended behaviour? I would have thought that RTLD_LOCAL
would start the library search afresh.
I have a small example C application that demonstrates the issue if required.
Any help/advice would be greatly appreciated :)
Cheers,
Mark