Fix BZ #17905
[glibc.git] / elf / nextmod1.c
blob56de3536a0f0495ea6023e12ed0a54da48288114
1 #include <dlfcn.h>
3 extern int successful_rtld_next_test (void);
4 extern void *failing_rtld_next_use (void);
6 int nextmod1_dummy_var;
8 int
9 successful_rtld_next_test (void)
11 int (*fp) (void);
13 /* Get the next function... */
14 fp = (int (*) (void)) dlsym (RTLD_NEXT, __FUNCTION__);
16 /* ...and simply call it. */
17 return fp ();
21 void *
22 failing_rtld_next_use (void)
24 void *ret = dlsym (RTLD_NEXT, __FUNCTION__);
26 /* Ensure we are not tail call optimized, because then RTLD_NEXT
27 might return this function. */
28 ++nextmod1_dummy_var;
29 return ret;