]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/s390/s390-32/tls-macros.h
[BZ #16214] S/390: Fix TLS GOT pointer setup.
[thirdparty/glibc.git] / sysdeps / s390 / s390-32 / tls-macros.h
index 8a0ad5863c73e9b78d8f6deadbd403efb6ff8f82..a592d81585cdc4b979ea113b640105bc8bc3ac9a 100644 (file)
@@ -8,12 +8,15 @@
 
 #ifdef PIC
 # define TLS_IE(x) \
-  ({ unsigned long __offset;                                                 \
+  ({ unsigned long __offset, __got;                                          \
      asm ("bras %0,1f\n"                                                     \
-         "0:\t.long " #x "@gotntpoff\n"                                      \
-         "1:\tl %0,0(%0)\n\t"                                                \
-         "l %0,0(%0,%%r12):tls_load:" #x                                     \
-         : "=&a" (__offset) : : "cc" );                                      \
+         "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) \