summaryrefslogtreecommitdiff
path: root/elf/tst-pathopt.c
blob: e2c96fbc72e37afc9f835840f49d49a77069be92 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <dlfcn.h>
#include <mcheck.h>
#include <stdio.h>
#include <stdlib.h>


static int
do_test (void)
{
  void *h;
  int (*fp) (int);
  int result;

  mtrace ();

  h = dlopen ("renamed.so", RTLD_LAZY);
  if (h == NULL)
    {
      printf ("failed to load \"%s\": %s\n", "renamed.so", dlerror ());
      exit (1);
    }

  fp = dlsym (h, "in_renamed");
  if (fp == NULL)
    {
      printf ("lookup of \"%s\" failed: %s\n", "in_renamed", dlerror ());
      exit (1);
    }

  result = fp (10);

  if (dlclose (h) != 0)
    {
      printf ("failed to close \"%s\": %s\n", "renamed.so", dlerror ());
      exit (1);
    }

  return result;
}

#include <support/test-driver.c>