2000-09-16 01:35:04 +08:00
|
|
|
#include <dlfcn.h>
|
|
|
|
|
2000-12-18 01:50:56 +08:00
|
|
|
extern int successful_rtld_next_test (void);
|
|
|
|
extern void *failing_rtld_next_use (void);
|
|
|
|
|
2000-10-03 15:37:02 +08:00
|
|
|
int nextmod1_dummy_var;
|
|
|
|
|
2000-09-16 01:35:04 +08:00
|
|
|
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)
|
|
|
|
{
|
2000-10-03 15:37:02 +08:00
|
|
|
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;
|
2000-09-16 01:35:04 +08:00
|
|
|
}
|