tst-tlsmod3.c 557 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdio.h>
  2. #include <tls.h>
  3. #ifdef USE_TLS
  4. # include "tls-macros.h"
  5. extern int in_dso (int n, int *caller_foop);
  6. COMMON_INT_DEF(comm_n);
  7. int
  8. in_dso2 (void)
  9. {
  10. int *foop;
  11. int result = 0;
  12. static int n;
  13. int *np;
  14. puts ("foo"); /* Make sure PLT is used before macros. */
  15. __asm__ ("" ::: "memory");
  16. foop = TLS_GD (foo);
  17. np = TLS_GD (comm_n);
  18. if (n != *np)
  19. {
  20. printf ("n = %d != comm_n = %d\n", n, *np);
  21. result = 1;
  22. }
  23. result |= in_dso (*foop = 42 + n++, foop);
  24. *foop = 16;
  25. return result;
  26. }
  27. #endif