diff options
Diffstat (limited to 'REORG.TODO/elf/nextmod1.c')
-rw-r--r-- | REORG.TODO/elf/nextmod1.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/REORG.TODO/elf/nextmod1.c b/REORG.TODO/elf/nextmod1.c new file mode 100644 index 0000000000..56de3536a0 --- /dev/null +++ b/REORG.TODO/elf/nextmod1.c @@ -0,0 +1,30 @@ +#include <dlfcn.h> + +extern int successful_rtld_next_test (void); +extern void *failing_rtld_next_use (void); + +int nextmod1_dummy_var; + +int +successful_rtld_next_test (void) +{ + int (*fp) (void); + + /* Get the next function... */ + fp = (int (*) (void)) dlsym (RTLD_NEXT, __FUNCTION__); + + /* ...and simply call it. */ + return fp (); +} + + +void * +failing_rtld_next_use (void) +{ + void *ret = dlsym (RTLD_NEXT, __FUNCTION__); + + /* Ensure we are not tail call optimized, because then RTLD_NEXT + might return this function. */ + ++nextmod1_dummy_var; + return ret; +} |