Blame sysdeps/i386/tls-macros.h

Packit 6c4009
#include <features.h> /* For __GNUC_PREREQ.  */
Packit 6c4009
Packit 6c4009
#define TLS_LE(x) \
Packit 6c4009
  ({ int *__l;								      \
Packit 6c4009
     asm ("movl %%gs:0,%0\n\t"						      \
Packit 6c4009
	  "subl $" #x "@tpoff,%0"					      \
Packit 6c4009
	  : "=r" (__l));						      \
Packit 6c4009
     __l; })
Packit 6c4009
Packit 6c4009
#if defined PIC && !__GNUC_PREREQ (5,0)
Packit 6c4009
# define TLS_IE(x) \
Packit 6c4009
  ({ int *__l;								      \
Packit 6c4009
     asm ("movl %%gs:0,%0\n\t"						      \
Packit 6c4009
	  "subl " #x "@gottpoff(%%ebx),%0"				      \
Packit 6c4009
	  : "=r" (__l));						      \
Packit 6c4009
     __l; })
Packit 6c4009
#else
Packit 6c4009
# define TLS_IE(x) \
Packit 6c4009
  ({ int *__l, __b;							      \
Packit 6c4009
     asm ("call 1f\n\t"							      \
Packit 6c4009
	  ".subsection 1\n"						      \
Packit 6c4009
	  "1:\tmovl (%%esp), %%ebx\n\t"					      \
Packit 6c4009
	  "ret\n\t"							      \
Packit 6c4009
	  ".previous\n\t"						      \
Packit 6c4009
	  "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"			      \
Packit 6c4009
	  "movl %%gs:0,%0\n\t"						      \
Packit 6c4009
	  "subl " #x "@gottpoff(%%ebx),%0"				      \
Packit 6c4009
	  : "=r" (__l), "=&b" (__b));					      \
Packit 6c4009
     __l; })
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined PIC && !__GNUC_PREREQ (5,0)
Packit 6c4009
# define TLS_LD(x) \
Packit 6c4009
  ({ int *__l, __c, __d;						      \
Packit 6c4009
     asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
Packit 6c4009
	  "call ___tls_get_addr@plt\n\t"				      \
Packit 6c4009
	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
Packit 6c4009
	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
Packit 6c4009
     __l; })
Packit 6c4009
#else
Packit 6c4009
# define TLS_LD(x) \
Packit 6c4009
  ({ int *__l, __b, __c, __d;						      \
Packit 6c4009
     asm ("call 1f\n\t"							      \
Packit 6c4009
	  ".subsection 1\n"						      \
Packit 6c4009
	  "1:\tmovl (%%esp), %%ebx\n\t"					      \
Packit 6c4009
	  "ret\n\t"							      \
Packit 6c4009
	  ".previous\n\t"						      \
Packit 6c4009
	  "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"			      \
Packit 6c4009
	  "leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
Packit 6c4009
	  "call ___tls_get_addr@plt\n\t"				      \
Packit 6c4009
	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
Packit 6c4009
	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
Packit 6c4009
     __l; })
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined PIC && !__GNUC_PREREQ (5,0)
Packit 6c4009
# define TLS_GD(x) \
Packit 6c4009
  ({ int *__l, __c, __d;						      \
Packit 6c4009
     asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
Packit 6c4009
	  "call ___tls_get_addr@plt\n\t"				      \
Packit 6c4009
	  "nop"								      \
Packit 6c4009
	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
Packit 6c4009
     __l; })
Packit 6c4009
#else
Packit 6c4009
# define TLS_GD(x) \
Packit 6c4009
  ({ int *__l, __b, __c, __d;						      \
Packit 6c4009
     asm ("call 1f\n\t"							      \
Packit 6c4009
	  ".subsection 1\n"						      \
Packit 6c4009
	  "1:\tmovl (%%esp), %%ebx\n\t"					      \
Packit 6c4009
	  "ret\n\t"							      \
Packit 6c4009
	  ".previous\n\t"						      \
Packit 6c4009
	  "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"			      \
Packit 6c4009
	  "leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
Packit 6c4009
	  "call ___tls_get_addr@plt\n\t"				      \
Packit 6c4009
	  "nop"								      \
Packit 6c4009
	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
Packit 6c4009
     __l; })
Packit 6c4009
#endif