nonstring: Enable __FORTIFY_LEVEL=3
[glibc.git] / elf / tst-tls4.c
blob6841f8138660d140bcb77236b8be39d0e2a6249f
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
6 static int
7 do_test (void)
9 static const char modname[] = "tst-tlsmod2.so";
10 int result = 0;
11 int *foop;
12 int (*fp) (int, int *);
13 void *h;
15 h = dlopen (modname, RTLD_LAZY);
16 if (h == NULL)
18 printf ("cannot open '%s': %s\n", modname, dlerror ());
19 exit (1);
22 fp = dlsym (h, "in_dso");
23 if (fp == NULL)
25 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
26 exit (1);
29 result |= fp (0, NULL);
31 foop = dlsym (h, "foo");
32 if (foop == NULL)
34 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
35 exit (1);
37 if (*foop != 16)
39 puts ("foo != 16");
40 result = 1;
43 dlclose (h);
45 return result;
49 #include <support/test-driver.c>