x86-64: Use _CET_NOTRACK in strcmp-sse42.S
[glibc.git] / elf / tst-tls5.c
blob5f006fd6459403fc957ab5d4c049d160b32a6975
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 *foop2;
13 int (*fp) (int, int *);
14 void *h;
16 h = dlopen (modname, RTLD_LAZY);
17 if (h == NULL)
19 printf ("cannot open '%s': %s\n", modname, dlerror ());
20 exit (1);
23 foop = dlsym (h, "foo");
24 if (foop == NULL)
26 printf ("cannot get symbol 'foo': %s\n", dlerror ());
27 exit (1);
30 *foop = 42;
32 fp = dlsym (h, "in_dso");
33 if (fp == NULL)
35 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
36 exit (1);
39 result |= fp (42, foop);
41 foop2 = dlsym (h, "foo");
42 if (foop2 == NULL)
44 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
45 exit (1);
48 if (foop != foop2)
50 puts ("address of 'foo' different the second time");
51 result = 1;
53 else if (*foop != 16)
55 puts ("foo != 16");
56 result = 1;
59 dlclose (h);
61 return result;
65 #include <support/test-driver.c>