a RTLD_LOCAL dlopen bug ?
风涯
fengya90 at gmail.com
Wed Sep 12 14:24:01 UTC 2012
the app dlopen the libmya.so,
the libmya.so is depend on libmyb.so
now,the mode of dlopen is RTLD_LOCAL,for example,
void *handle = dlopen("libmya.so", RTLD_LAZY|RTLD_LOCAL);
if there is a globle variable int the libmya.so, can the function in the
libmyb.so find it ?
just as below
app dlopen the libmya.so
when compile and link the libmya.so, we just do
gcc -shared -fPIC libmya.c ./libmyb.so -o libmya.so
now ,if in the uclibc , the variable a in funcb will not be found
in the glibc ,the variable will be found.
i have read the source code of ld.so and libdl.so in the uclibc.0.9.32
but i wander which implementation is right ?or it just a bug of uclibc?
/* app */
#include<dlfcn.h>
int main(int argc,char *argv[])
{
void (* func)();
void *handle = dlopen("libmya.so", RTLD_LAZY|RTLD_LOCAL);
if(!handle)
{
return;
}
func = dlsym(handle, "funca");
func();
dlclose(handle);
return 0;
}
/* libmya.so */
int a=1;
void funca
{
funcb();
}
/* libmyb.so */
extern int a;
void funcb
{
a=1;
}
More information about the uClibc
mailing list