summary refs log tree commit diff
path: root/elf/tls-macros.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-02-25 23:27:06 +0000
committerRoland McGrath <roland@gnu.org>2003-02-25 23:27:06 +0000
commitfec417190420a427bec2340853f42051da251b65 (patch)
tree2a346cb4f4a9d498de755502484a3b4937df79ec /elf/tls-macros.h
parent3c2a3b41063d5f18d45cbc3039c8faf6ef813175 (diff)
downloadglibc-fec417190420a427bec2340853f42051da251b65.tar.gz
glibc-fec417190420a427bec2340853f42051da251b65.tar.xz
glibc-fec417190420a427bec2340853f42051da251b65.zip
2003-02-25 Steven Munroe <sjmunroe@us.ibm.com>
        * elf/elf.h: Add new R_PPC64_* relocs for TLS.
        * elf/tls-macros.h [__powerpc64__]
        (TLS_LE, TLS_IE, TLS_LD, TLS_GD): Define.
	* sysdeps/powerpc/powerpc64/elf/configure.in: New file.
	* sysdeps/powerpc/powerpc64/elf/configure: New file (generated).

        * sysdeps/powerpc/elf/libc-start.c (__libc_start_main):
	Do DL_SYSDEP_OSCHECK here, matching 2002-12-01 change to generic file.
Diffstat (limited to 'elf/tls-macros.h')
-rw-r--r--elf/tls-macros.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/elf/tls-macros.h b/elf/tls-macros.h
index 81736c95b9..a1ae536bef 100644
--- a/elf/tls-macros.h
+++ b/elf/tls-macros.h
@@ -623,6 +623,58 @@ register void *__gp __asm__("$29");
      (int *) (__builtin_thread_pointer() + __offset); })
 # endif
 
+#elif defined __powerpc__ && defined __powerpc64__
+
+/* PowerPC64 Local Exec TLS access.  */
+# define TLS_LE(x) \
+  ({  int * __result;  \
+      asm ( \
+        "  addis %0,13," #x "@tprel@ha\n"  \
+        "  addi  %0,%0," #x "@tprel@l\n"   \
+        : "=b" (__result) );  \
+      __result;  \
+  })
+/* PowerPC64 Initial Exec TLS access.  */
+#  define TLS_IE(x) \
+  ({  int * __result;  \
+      asm (  \
+        "  ld  %0," #x "@got@tprel(2)\n"  \
+        "  add %0,%0," #x "@tls\n"   \
+        : "=b" (__result) );  \
+      __result;  \
+  })
+/* PowerPC64 Local Dynamic TLS access.  */
+#  define TLS_LD(x) \
+  ({  int * __result;  \
+      asm (  \
+        "  addi  3,2," #x "@got@tlsld\n"  \
+        "  bl    .__tls_get_addr\n"  \
+        "  nop   \n"  \
+        "  addis %0,3," #x "@dtprel@ha\n"  \
+        "  addi  %0,%0," #x "@dtprel@l\n"  \
+        : "=b" (__result) :  \
+        : "0", "3", "4", "5", "6", "7",    \
+          "8", "9", "10", "11", "12",      \
+          "lr", "ctr",  \
+          "cr0", "cr1", "cr5", "cr6", "cr7");  \
+      __result;  \
+  })
+/* PowerPC64 General Dynamic TLS access.  */
+#  define TLS_GD(x) \
+  ({  int * __result;  \
+      asm (  \
+        "  addi  3,2," #x "@got@tlsgd\n"  \
+        "  bl    .__tls_get_addr\n"  \
+        "  nop   \n"  \
+        "  mr    %0,3\n"  \
+        : "=b" (__result) :  \
+        : "0", "3", "4", "5", "6", "7",    \
+          "8", "9", "10", "11", "12",      \
+          "lr", "ctr",  \
+          "cr0", "cr1", "cr5", "cr6", "cr7");  \
+      __result;  \
+  })
+
 #else
 # error "No support for this architecture so far."
 #endif