]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/tst-tls4.c
.
[thirdparty/glibc.git] / elf / tst-tls4.c
CommitLineData
aed283dd
UD
1#include <dlfcn.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5#include <tls.h>
6
7
8#define TEST_FUNCTION do_test ()
9static int
10do_test (void)
11{
32c075e1 12#ifdef USE_TLS
aed283dd
UD
13 static const char modname[] = "tst-tlsmod2.so";
14 int result = 0;
15 int *foop;
16 int (*fp) (int, int *);
17 void *h;
18
19 h = dlopen (modname, RTLD_LAZY);
20 if (h == NULL)
21 {
22 printf ("cannot open '%s': %s\n", modname, dlerror ());
23 exit (1);
24 }
25
26 fp = dlsym (h, "in_dso");
27 if (fp == NULL)
28 {
29 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
30 exit (1);
31 }
32
33 result |= fp (0, NULL);
34
35 foop = dlsym (h, "foo");
36 if (foop == NULL)
37 {
38 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
39 exit (1);
40 }
41 if (*foop != 16)
42 {
43 puts ("foo != 16");
44 result = 1;
45 }
46
47 dlclose (h);
48
49 return result;
32c075e1
JJ
50#else
51 return 0;
52#endif
aed283dd
UD
53}
54
55
56#include "../test-skeleton.c"