lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include <config.h> |
| 2 | #include <dlfcn.h> |
| 3 | #include <stdio.h> |
| 4 | |
| 5 | extern int var; |
| 6 | |
| 7 | static int |
| 8 | do_test (void) |
| 9 | { |
| 10 | #ifdef HAVE_ASM_UNIQUE_OBJECT |
| 11 | var = 1; |
| 12 | |
| 13 | void *h = dlopen ("tst-unique2mod2.so", RTLD_LAZY); |
| 14 | if (h == NULL) |
| 15 | { |
| 16 | puts ("cannot load tst-unique2mod2"); |
| 17 | return 1; |
| 18 | } |
| 19 | int (*f) (int *) = dlsym (h, "f"); |
| 20 | if (f == NULL) |
| 21 | { |
| 22 | puts ("cannot locate f in tst-unique2mod2"); |
| 23 | return 1; |
| 24 | } |
| 25 | return f (&var); |
| 26 | #else |
| 27 | return 0; |
| 28 | #endif |
| 29 | } |
| 30 | |
| 31 | #define TEST_FUNCTION do_test () |
| 32 | #include "../test-skeleton.c" |