Hi,

I encountered a problem, when I used dlsym with RTLD_DEFAULT.

E.g.

$ cat test.c 
#include <dlfcn.h>
#include <stdio.h>

int main(void)
{
        void *libaa = dlopen("./aa.so", RTLD_LAZY);
        void (*aaTest1)(void *);

        if (libaa == NULL) {
                printf("dlopen failed\n");
                return 1;
        }

        aaTest1 = dlsym(libaa, "aaTest1");

        (*aaTest1)(libaa);

        dlclose(libaa);
        return 0;
}

$ cat aa.c
#define  _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>

int aaSymbol;

void *aaTest1(void *libaa)
{
        printf("%p\n", dlsym(RTLD_DEFAULT, "aaSymbol"));

        return NULL;
}

Using uclibc:

$ CC -o test test.c -ldl
$ CC -o aa.so aa.c -shared -fPIC -ldl
$ ./test
(nil)


Using glibc:

$ CC -o test test.c -ldl
$ CC -o aa.so aa.c -shared -fPIC -ldl
$ ./test
0x7ffcbbb4e030

I cannot find the symbols of libaa.so in libaa with RTLD_DEFAULT,
but it can be found with using glibc.

Is it a bug or just different from glibc ?


_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to