Update from translation team.
[glibc.git] / elf / tst-tls5.c
blob27b18294fb2b8eb370101bfef12eab1dbe10a28e
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 #include <tls.h>
8 #define TEST_FUNCTION do_test ()
9 static int
10 do_test (void)
12 static const char modname[] = "tst-tlsmod2.so";
13 int result = 0;
14 int *foop;
15 int *foop2;
16 int (*fp) (int, int *);
17 void *h;
19 h = dlopen (modname, RTLD_LAZY);
20 if (h == NULL)
22 printf ("cannot open '%s': %s\n", modname, dlerror ());
23 exit (1);
26 foop = dlsym (h, "foo");
27 if (foop == NULL)
29 printf ("cannot get symbol 'foo': %s\n", dlerror ());
30 exit (1);
33 *foop = 42;
35 fp = dlsym (h, "in_dso");
36 if (fp == NULL)
38 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
39 exit (1);
42 result |= fp (42, foop);
44 foop2 = dlsym (h, "foo");
45 if (foop2 == NULL)
47 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
48 exit (1);
51 if (foop != foop2)
53 puts ("address of 'foo' different the second time");
54 result = 1;
56 else if (*foop != 16)
58 puts ("foo != 16");
59 result = 1;
62 dlclose (h);
64 return result;
68 #include "../test-skeleton.c"