glibc/sysdeps/s390/s390-32/tls-macros.h
Stefan Liebler 31cf39421b S390: Use __asm__ instead of asm.
* sysdeps/s390/fpu/bits/mathinline.h:
	Use __asm__ [__volatile__] instead of asm [volatile].
	* sysdeps/s390/abort-instr.h: Likewise.
	* sysdeps/s390/atomic-machine.h: Likewise.
	* sysdeps/s390/bits/string.h: Likewise.
	* sysdeps/s390/dl-tls.h: Likewise.
	* sysdeps/s390/fpu/e_sqrt.c: Likewise.
	* sysdeps/s390/fpu/e_sqrtf.c: Likewise.
	* sysdeps/s390/fpu/e_sqrtl.c: Likewise.
	* sysdeps/s390/fpu/fesetround.c: Likewise.
	* sysdeps/s390/fpu/fpu_control.h: Likewise.
	* sysdeps/s390/fpu/s_fma.c: Likewise.
	* sysdeps/s390/fpu/s_fmaf.c: Likewise.
	* sysdeps/s390/memusage.h: Likewise.
	* sysdeps/s390/multiarch/ifunc-resolve.h: Likewise.
	* sysdeps/s390/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/s390/nptl/pthread_spin_trylock.c: Likewise.
	* sysdeps/s390/nptl/pthread_spin_unlock.c: Likewise.
	* sysdeps/s390/nptl/tls.h: Likewise.
	* sysdeps/s390/s390-32/__longjmp.c: Likewise.
	* sysdeps/s390/s390-32/backtrace.c: Likewise.
	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
	* sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise.
	* sysdeps/s390/s390-32/stackguard-macros.h: Likewise.
	* sysdeps/s390/s390-32/tls-macros.h: Likewise.
	* sysdeps/s390/s390-64/__longjmp.c: Likewise.
	* sysdeps/s390/s390-64/backtrace.c: Likewise.
	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
	* sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c: Likewise.
	* sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise.
	* sysdeps/s390/s390-64/stackguard-macros.h: Likewise.
	* sysdeps/s390/s390-64/tls-macros.h: Likewise.
	* sysdeps/s390/s390-64/utf16-utf32-z9.c: Likewise.
	* sysdeps/s390/s390-64/utf8-utf16-z9.c: Likewise.
	* sysdeps/s390/s390-64/utf8-utf32-z9.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/brk.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/elision-trylock.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/sysconf.c: Likewise.
2015-11-20 08:56:40 +01:00

103 lines
4.0 KiB
C

#define TLS_LE(x) \
({ unsigned long __offset; \
__asm__ ("bras %0,1f\n" \
"0:\t.long " #x "@ntpoff\n" \
"1:\tl %0,0(%0)" \
: "=a" (__offset) : : "cc" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#ifdef PIC
# define TLS_IE(x) \
({ unsigned long __offset, __got; \
__asm__ ("bras %0,1f\n" \
"0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \
".long " #x "@gotntpoff\n" \
"1:\tl %1,0(%0)\n\t" \
"la %1,0(%1,%0)\n\t" \
"l %0,4(%0)\n\t" \
"l %0,0(%0,%1):tls_load:" #x "\n" \
: "=&a" (__offset), "=&a" (__got) : : "cc" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#else
# define TLS_IE(x) \
({ unsigned long __offset; \
__asm__ ("bras %0,1f\n" \
"0:\t.long " #x "@indntpoff\n" \
"1:\t l %0,0(%0)\n\t" \
"l %0,0(%0):tls_load:" #x \
: "=&a" (__offset) : : "cc" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#endif
#ifdef PIC
# define TLS_LD(x) \
({ unsigned long __offset, __save12; \
__asm__ ("bras %0,1f\n" \
"0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \
".long __tls_get_offset@plt-0b\n\t" \
".long " #x "@tlsldm\n\t" \
".long " #x "@dtpoff\n" \
"1:\tlr %1,%%r12\n\t" \
"l %%r12,0(%0)\n\t" \
"la %%r12,0(%%r12,%0)\n\t" \
"l %%r1,4(%0)\n\t" \
"l %%r2,8(%0)\n\t" \
"bas %%r14,0(%%r1,%0):tls_ldcall:" #x "\n\t" \
"l %0,12(%0)\n\t" \
"alr %0,%%r2\n\t" \
"lr %%r12,%1" \
: "=&a" (__offset), "=&a" (__save12) \
: : "cc", "0", "1", "2", "3", "4", "5" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#else
# define TLS_LD(x) \
({ unsigned long __offset; \
__asm__ ("bras %0,1f\n" \
"0:\t.long _GLOBAL_OFFSET_TABLE_\n\t" \
".long __tls_get_offset@plt\n\t" \
".long " #x "@tlsldm\n\t" \
".long " #x "@dtpoff\n" \
"1:\tl %%r12,0(%0)\n\t" \
"l %%r1,4(%0)\n\t" \
"l %%r2,8(%0)\n\t" \
"bas %%r14,0(%%r1):tls_ldcall:" #x "\n\t" \
"l %0,12(%0)\n\t" \
"alr %0,%%r2" \
: "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#endif
#ifdef PIC
# define TLS_GD(x) \
({ unsigned long __offset, __save12; \
__asm__ ("bras %0,1f\n" \
"0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \
".long __tls_get_offset@plt-0b\n\t" \
".long " #x "@tlsgd\n" \
"1:\tlr %1,%%r12\n\t" \
"l %%r12,0(%0)\n\t" \
"la %%r12,0(%%r12,%0)\n\t" \
"l %%r1,4(%0)\n\t" \
"l %%r2,8(%0)\n\t" \
"bas %%r14,0(%%r1,%0):tls_gdcall:" #x "\n\t" \
"lr %0,%%r2\n\t" \
"lr %%r12,%1" \
: "=&a" (__offset), "=&a" (__save12) \
: : "cc", "0", "1", "2", "3", "4", "5" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#else
# define TLS_GD(x) \
({ unsigned long __offset; \
__asm__ ("bras %0,1f\n" \
"0:\t.long _GLOBAL_OFFSET_TABLE_\n\t" \
".long __tls_get_offset@plt\n\t" \
".long " #x "@tlsgd\n" \
"1:\tl %%r12,0(%0)\n\t" \
"l %%r1,4(%0)\n\t" \
"l %%r2,8(%0)\n\t" \
"bas %%r14,0(%%r1):tls_gdcall:" #x "\n\t" \
"lr %0,%%r2" \
: "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \
(int *) (__builtin_thread_pointer() + __offset); })
#endif