summaryrefslogtreecommitdiff
path: root/elf/tst-unique1.c
blob: 9b7996cd964ff7fb97a1558724252d155666d44f (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
#include <config.h>
#include <dlfcn.h>
#include <stdio.h>

static int
do_test (void)
{
#ifdef HAVE_ASM_UNIQUE_OBJECT
  void *h1 = dlopen ("tst-unique1mod1.so", RTLD_LAZY);
  if (h1 == NULL)
    {
      puts ("cannot load tst-unique1mod1");
      return 1;
    }
  int *(*f1) (void) = dlsym (h1, "f");
  if (f1 == NULL)
    {
      puts ("cannot locate f in tst-unique1mod1");
      return 1;
    }
  void *h2 = dlopen ("tst-unique1mod2.so", RTLD_LAZY);
  if (h2 == NULL)
    {
      puts ("cannot load tst-unique1mod2");
      return 1;
    }
  int (*f2) (int *) = dlsym (h2, "f");
  if (f2 == NULL)
    {
      puts ("cannot locate f in tst-unique1mod2");
      return 1;
    }
  return f2 (f1 ());
#else
  return 0;
#endif
}

#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"