tls-macros-arc.h 806 B

1234567891011121314151617181920212223242526
  1. /* For now */
  2. #define TLS_LD(x) TLS_IE(x)
  3. #define TLS_GD(x) \
  4. ({ void *__result; \
  5. extern void *__tls_get_addr (void *); \
  6. __asm__ ("add %0, pcl, @" #x "@tlsgd \n" \
  7. ".tls_gd_ld " #x " \n" \
  8. : "=r" (__result)); \
  9. (int *)__tls_get_addr(__result); })
  10. #define TLS_LE(x) \
  11. ({ int *__result; \
  12. void *tp = __builtin_thread_pointer(); \
  13. __asm__ ("add %0, %1, @" #x "@tpoff \n" \
  14. : "=r" (__result) : "r"(tp)); \
  15. __result; })
  16. #define TLS_IE(x) \
  17. ({ int *__result; \
  18. void *tp = __builtin_thread_pointer(); \
  19. __asm__ ("ld %0, [pcl, @" #x "@tlsie] \n" \
  20. "add %0, %1, %0 \n" \
  21. : "=&r" (__result) : "r" (tp)); \
  22. __result; })