2002-08-21 Roland McGrath <roland@redhat.com>
[platform/upstream/glibc.git] / dlfcn / bug-dlsym1.c
1 /* Test case for bug in dlsym accessing dependency objects' symbols.  */
2
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <unistd.h>
6 #include <dlfcn.h>
7
8 int main(void)
9 {
10     void *handle;
11     char *c;
12
13     setenv ("LD_LIBRARY_PATH", "/home/roland/build/tls-libc/dlfcn", 1);
14
15     /* open lib1.so, which has the unresolved test symbol and a DT_NEEDED
16        on lib2.so, which provides the symbol */
17     if ((handle = dlopen("bug-dlsym1-lib1.so", RTLD_NOW)) == NULL) {
18         printf("dlopen(\"bug-dlsym1-lib1.so\"): %s\n", dlerror());
19         abort();
20     }
21
22     if ((c = dlsym(handle, "dlopen_test_variable")) == NULL) {
23         printf("dlsym(handle, \"dlopen_test_variable\"): %s\n", dlerror());
24         abort();
25     }
26
27     (void) dlclose(handle);
28
29     return 0;
30 }