source: branches/libc-0.6/src/libctests/glibc/elf/tst-tlsmod2.c

Last change on this file was 2036, checked in by bird, 20 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 573 bytes
Line 
1#include <stdio.h>
2
3#include <tls.h>
4
5#ifdef USE_TLS
6#include "tls-macros.h"
7
8
9COMMON_INT_DEF(foo);
10
11
12int
13in_dso (int n, int *caller_foop)
14{
15 int *foop;
16 int result = 0;
17
18 puts ("foo"); /* Make sure PLT is used before macros. */
19 asm ("" ::: "memory");
20
21 foop = TLS_GD (foo);
22
23 if (caller_foop != NULL && foop != caller_foop)
24 {
25 printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
26 result = 1;
27 }
28 else if (*foop != n)
29 {
30 printf ("foo != %d\n", n);
31 result = 1;
32 }
33
34 *foop = 16;
35
36 return result;
37}
38#endif
Note: See TracBrowser for help on using the repository browser.