S390: Clobber also r14 in TLS_LD, TLS_GD macros on 31bit.

This patch also clobbers r14 in TLS_LD, TLS_GD macros on 31bit.
This ensures that r14 isn't used to save and restore r12 while
r14 is clobbered by the bas-instruction.

As note:
r12 can't be added to clobber list as gcc would fail with:
error: PIC register clobbered by ‘12’ in ‘asm’

For 64bit this fix was already done in 2004 in the
commit b80af23ac6.

ChangeLog:

	* sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD):
	Clobber also r14.
This commit is contained in:
Stefan Liebler 2017-04-04 13:16:28 +02:00
parent 83f0ad2bc6
commit fce3da82e5
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2017-04-04 Stefan Liebler <stli@linux.vnet.ibm.com>
* sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD):
Clobber also r14.
2017-04-03 Mike Frysinger <vapier@gentoo.org> 2017-04-03 Mike Frysinger <vapier@gentoo.org>
[BZ #21253] [BZ #21253]

View File

@ -47,7 +47,7 @@
"alr %0,%%r2\n\t" \ "alr %0,%%r2\n\t" \
"lr %%r12,%1" \ "lr %%r12,%1" \
: "=&a" (__offset), "=&a" (__save12) \ : "=&a" (__offset), "=&a" (__save12) \
: : "cc", "0", "1", "2", "3", "4", "5" ); \ : : "cc", "0", "1", "2", "3", "4", "5", "14"); \
(int *) (__builtin_thread_pointer() + __offset); }) (int *) (__builtin_thread_pointer() + __offset); })
#else #else
# define TLS_LD(x) \ # define TLS_LD(x) \
@ -63,7 +63,8 @@
"bas %%r14,0(%%r1):tls_ldcall:" #x "\n\t" \ "bas %%r14,0(%%r1):tls_ldcall:" #x "\n\t" \
"l %0,12(%0)\n\t" \ "l %0,12(%0)\n\t" \
"alr %0,%%r2" \ "alr %0,%%r2" \
: "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \ : "=&a" (__offset) \
: : "cc", "0", "1", "2", "3", "4", "5", "12", "14"); \
(int *) (__builtin_thread_pointer() + __offset); }) (int *) (__builtin_thread_pointer() + __offset); })
#endif #endif
@ -83,7 +84,7 @@
"lr %0,%%r2\n\t" \ "lr %0,%%r2\n\t" \
"lr %%r12,%1" \ "lr %%r12,%1" \
: "=&a" (__offset), "=&a" (__save12) \ : "=&a" (__offset), "=&a" (__save12) \
: : "cc", "0", "1", "2", "3", "4", "5" ); \ : : "cc", "0", "1", "2", "3", "4", "5", "14"); \
(int *) (__builtin_thread_pointer() + __offset); }) (int *) (__builtin_thread_pointer() + __offset); })
#else #else
# define TLS_GD(x) \ # define TLS_GD(x) \
@ -97,6 +98,7 @@
"l %%r2,8(%0)\n\t" \ "l %%r2,8(%0)\n\t" \
"bas %%r14,0(%%r1):tls_gdcall:" #x "\n\t" \ "bas %%r14,0(%%r1):tls_gdcall:" #x "\n\t" \
"lr %0,%%r2" \ "lr %0,%%r2" \
: "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \ : "=&a" (__offset) \
: : "cc", "0", "1", "2", "3", "4", "5", "12", "14"); \
(int *) (__builtin_thread_pointer() + __offset); }) (int *) (__builtin_thread_pointer() + __offset); })
#endif #endif