[uClibc] dlsym finds symbols in libraries other than the one specified

peter.vanhoyweghen at banksys.be peter.vanhoyweghen at banksys.be
Mon Jul 26 08:49:47 UTC 2004


Hi all,


If I use dlsym() to retrieve a function in a library opened with dlopen(),
and if that library has no such function, dlopen() may find it in any
previously opened library. ( I specify a handle that is not NULL nor
RTLD_NEXT). I think dlsym() should only search the libraries needed
(directly or indirectly) by the library plus any libraries dlopened() with
flag RTLD_GLOBAL set (which I don't). 

This confuses my application which (dl)opens shared libraries and queries
them for a set of functions with agreed on names. If one of the functions is
not there, it is simply not used. With uclibc 0.9.19 this worked (but that
version had other problems (unresolved symbols in libraries indirectly
needed by the dlopend library) which have been fixed now. Thanks!). With
uclibc 0.9.26 the app may use a function of a different library.

Temporarilly I work around with a modified version of void* dlsym(void*
vhandle, const char* name) :
If vhandle is not NULL, nor RTLD_NEXT, it only searches the symbols of the
library itself (i.e it executes only the inner for loop of _dl_find_hash()
and does not descend in the rpnt->next chain). This works for me but is
incomplete since it does not search in needed libraries nor libs with
RTLD_GLOBAL set.
(I use a post 0.9.26 buildroot snapshot (July 2004), binutils 2.14.90.0.6 ,
gcc 3.3.4, my target is arm)

Thanks for any suggestions...


Peter





"The information contained in this e-mail and any attachment thereto is confidential and
may contain information which is protected by intellectual property rights.
This information is intended for the exclusive use of the recipient(s) named above.
This e-mail does not constitute any binding relationship or offer toward any of the addressees.
If you are not one of the addressees , one of their employees or a proxy holder entitled 
to hand over this message to the addressee(s), any use of the information contained 
herein (e.g. reproduction, divulgation, communication or distribution,...) is prohibited.
If you have received this message in error, please notify the sender and destroy it immediately after.
The integrity and security of this message cannot be guaranteed and it may be subject to 
data corruption, interception and unauthorized amendment, for which we accept no liability."




More information about the uClibc mailing list