public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix s390x tst-tls* when built with GCC 3.4+
@ 2004-06-10 21:57 Jakub Jelinek
  2004-06-11  9:06 ` Martin Schwidefsky
  2004-06-11  9:55 ` Roland McGrath
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2004-06-10 21:57 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

GCC 3.4+ on s390x no longer considers r14 to be a fixed register, so we need
to tell the compiler we are clobbering it, otherwise GCC puts vital
temporaries in it and they get clobbered by the TLS_{LD,GD} macros.
I have built tst-tlsmod2.c with this patch even with GCC 3.3 and it built
just fine.

2004-06-10  Jakub Jelinek  <jakub@redhat.com>

	* elf/tls-macros.h [__s390x__] (TLS_LD, TLS_GD): Clobber also r14.

--- libc/elf/tls-macros.h.jj	2003-09-11 19:35:21.000000000 -0400
+++ libc/elf/tls-macros.h	2004-06-10 17:48:09.000000000 -0400
@@ -484,7 +484,7 @@ register void *__gp __asm__("$29");
 	  "algr %0,%%r2\n\t"						      \
           "lgr %%r12,%1"						      \
 	  : "=&a" (__offset), "=&a" (__save12)				      \
-          : : "cc", "0", "1", "2", "3", "4", "5" );			      \
+          : : "cc", "0", "1", "2", "3", "4", "5", "14" );		      \
      (int *) (__builtin_thread_pointer() + __offset); })
 # else
 #  define TLS_LD(x) \
@@ -497,7 +497,8 @@ register void *__gp __asm__("$29");
 	  "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t"	      \
 	  "lg %0,8(%0)\n\t"						      \
 	  "algr %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); })
 # endif
 
@@ -513,7 +514,7 @@ register void *__gp __asm__("$29");
           "lgr %0,%%r2\n\t"						      \
           "lgr %%r12,%1"						      \
 	  : "=&a" (__offset), "=&a" (__save12)				      \
-          : : "cc", "0", "1", "2", "3", "4", "5" );			      \
+          : : "cc", "0", "1", "2", "3", "4", "5", "14" );		      \
      (int *) (__builtin_thread_pointer() + __offset); })
 # else
 #  define TLS_GD(x) \
@@ -524,7 +525,8 @@ register void *__gp __asm__("$29");
 	  "lg %%r2,0(%0)\n\t"						      \
 	  "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t"	      \
           "lgr %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); })
 # endif
 

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix s390x tst-tls* when built with GCC 3.4+
  2004-06-10 21:57 [PATCH] Fix s390x tst-tls* when built with GCC 3.4+ Jakub Jelinek
@ 2004-06-11  9:06 ` Martin Schwidefsky
  2004-06-11  9:55 ` Roland McGrath
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Schwidefsky @ 2004-06-11  9:06 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers, Roland McGrath





> GCC 3.4+ on s390x no longer considers r14 to be a fixed register, so we
need
> to tell the compiler we are clobbering it, otherwise GCC puts vital
> temporaries in it and they get clobbered by the TLS_{LD,GD} macros.
> I have built tst-tlsmod2.c with this patch even with GCC 3.3 and it built
> just fine.

Patch is fine with me.

blue skies,
   Martin

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix s390x tst-tls* when built with GCC 3.4+
  2004-06-10 21:57 [PATCH] Fix s390x tst-tls* when built with GCC 3.4+ Jakub Jelinek
  2004-06-11  9:06 ` Martin Schwidefsky
@ 2004-06-11  9:55 ` Roland McGrath
  1 sibling, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2004-06-11  9:55 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

> 2004-06-10  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* elf/tls-macros.h [__s390x__] (TLS_LD, TLS_GD): Clobber also r14.

I've put this in.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-11  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-10 21:57 [PATCH] Fix s390x tst-tls* when built with GCC 3.4+ Jakub Jelinek
2004-06-11  9:06 ` Martin Schwidefsky
2004-06-11  9:55 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).