xf.li | bfc6e71 | 2025-02-07 01:54:34 -0800 | [diff] [blame^] | 1 | /* Include sysdeps/powerpc/tls-macros.h for __TLS_CALL_CLOBBERS */ |
| 2 | #include_next "tls-macros.h" |
| 3 | |
| 4 | /* PowerPC64 Local Exec TLS access. */ |
| 5 | #define TLS_LE(x) \ |
| 6 | ({ int * __result; \ |
| 7 | asm ("addis %0,13," #x "@tprel@ha\n\t" \ |
| 8 | "addi %0,%0," #x "@tprel@l" \ |
| 9 | : "=b" (__result) ); \ |
| 10 | __result; \ |
| 11 | }) |
| 12 | /* PowerPC64 Initial Exec TLS access. */ |
| 13 | #define TLS_IE(x) \ |
| 14 | ({ int * __result; \ |
| 15 | asm ("ld %0," #x "@got@tprel(2)\n\t" \ |
| 16 | "add %0,%0," #x "@tls" \ |
| 17 | : "=r" (__result) ); \ |
| 18 | __result; \ |
| 19 | }) |
| 20 | |
| 21 | #define __TLS_GET_ADDR "__tls_get_addr" |
| 22 | |
| 23 | /* PowerPC64 Local Dynamic TLS access. */ |
| 24 | #define TLS_LD(x) \ |
| 25 | ({ int * __result; \ |
| 26 | asm ("addi 3,2," #x "@got@tlsld\n\t" \ |
| 27 | "bl " __TLS_GET_ADDR "\n\t" \ |
| 28 | "nop \n\t" \ |
| 29 | "addis %0,3," #x "@dtprel@ha\n\t" \ |
| 30 | "addi %0,%0," #x "@dtprel@l" \ |
| 31 | : "=b" (__result) : \ |
| 32 | : "3", __TLS_CALL_CLOBBERS); \ |
| 33 | __result; \ |
| 34 | }) |
| 35 | /* PowerPC64 General Dynamic TLS access. */ |
| 36 | #define TLS_GD(x) \ |
| 37 | ({ register int *__result __asm__ ("r3"); \ |
| 38 | asm ("addi 3,2," #x "@got@tlsgd\n\t" \ |
| 39 | "bl " __TLS_GET_ADDR "\n\t" \ |
| 40 | "nop " \ |
| 41 | : "=r" (__result) : \ |
| 42 | : __TLS_CALL_CLOBBERS); \ |
| 43 | __result; \ |
| 44 | }) |