]>
Commit | Line | Data |
---|---|---|
917fd061 UD |
1 | #include <dlfcn.h> |
2 | ||
5c80f57c AJ |
3 | extern int successful_rtld_next_test (void); |
4 | extern void *failing_rtld_next_use (void); | |
5 | ||
e6ea9c0d UD |
6 | int nextmod1_dummy_var; |
7 | ||
917fd061 UD |
8 | int |
9 | successful_rtld_next_test (void) | |
10 | { | |
11 | int (*fp) (void); | |
12 | ||
13 | /* Get the next function... */ | |
14 | fp = (int (*) (void)) dlsym (RTLD_NEXT, __FUNCTION__); | |
15 | ||
16 | /* ...and simply call it. */ | |
17 | return fp (); | |
18 | } | |
19 | ||
20 | ||
21 | void * | |
22 | failing_rtld_next_use (void) | |
23 | { | |
e6ea9c0d UD |
24 | void *ret = dlsym (RTLD_NEXT, __FUNCTION__); |
25 | ||
26 | /* Ensure we are not tail call optimized, because then RTLD_NEXT | |
27 | might return this function. */ | |
28 | ++nextmod1_dummy_var; | |
29 | return ret; | |
917fd061 | 30 | } |