__tls_get_addr.c 354 B

12345678910111213141516
  1. #include <stddef.h>
  2. #include "pthread_impl.h"
  3. void *__tls_get_addr(size_t *v)
  4. {
  5. pthread_t self = __pthread_self();
  6. #ifdef SHARED
  7. __attribute__((__visibility__("hidden")))
  8. void *__tls_get_new(size_t *);
  9. if (v[0]<=(size_t)self->dtv[0])
  10. return (char *)self->dtv[v[0]]+v[1];
  11. return __tls_get_new(v);
  12. #else
  13. return (char *)self->dtv[1]+v[1];
  14. #endif
  15. }