tst-tls15.c 610 B

123456789101112131415161718192021222324252627282930313233
  1. #include <dlfcn.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. static int
  5. do_test (void)
  6. {
  7. void *h = dlopen ("tst-tlsmod15a.so", RTLD_NOW);
  8. if (h != NULL)
  9. {
  10. puts ("unexpectedly succeeded to open tst-tlsmod15a.so");
  11. exit (1);
  12. }
  13. h = dlopen ("tst-tlsmod15b.so", RTLD_NOW);
  14. if (h == NULL)
  15. {
  16. puts ("failed to open tst-tlsmod15b.so");
  17. exit (1);
  18. }
  19. int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso");
  20. if (fp == NULL)
  21. {
  22. puts ("cannot find in_dso");
  23. exit (1);
  24. }
  25. return fp ();
  26. }
  27. #define TEST_FUNCTION do_test ()
  28. #include "../test-skeleton.c"