about summary refs log tree commit diff
path: root/elf/nextmod1.c
blob: 19f972b9e029fc715744bf20e6eff2ad36502c2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <dlfcn.h>

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;
}