From fec417190420a427bec2340853f42051da251b65 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 25 Feb 2003 23:27:06 +0000 Subject: 2003-02-25 Steven Munroe * 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. --- elf/tls-macros.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'elf/tls-macros.h') 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 -- cgit v1.2.3