lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include <dlfcn.h> |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | static int |
| 5 | do_test (void) |
| 6 | { |
| 7 | void *h1 = dlopen ("$ORIGIN/testobj6.so", RTLD_GLOBAL|RTLD_LAZY); |
| 8 | if (h1 == NULL) |
| 9 | { |
| 10 | puts ("cannot open testobj6"); |
| 11 | return 1; |
| 12 | } |
| 13 | |
| 14 | void *h2 = dlopen ("$ORIGIN/testobj2.so", |
| 15 | RTLD_GLOBAL|RTLD_DEEPBIND|RTLD_LAZY); |
| 16 | if (h2 == NULL) |
| 17 | { |
| 18 | puts ("cannot open testobj2"); |
| 19 | return 1; |
| 20 | } |
| 21 | |
| 22 | dlclose (h1); |
| 23 | |
| 24 | void (*f) (void) = dlsym (h2, "p"); |
| 25 | if (f == NULL) |
| 26 | { |
| 27 | puts ("cannot find p"); |
| 28 | return 1; |
| 29 | } |
| 30 | |
| 31 | f (); |
| 32 | |
| 33 | dlclose (h2); |
| 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | #define TEST_FUNCTION do_test () |
| 39 | #include "../test-skeleton.c" |