]>
Commit | Line | Data |
---|---|---|
0e7d930c | 1 | /* Macros to support TLS testing in times of missing compiler support. ARC version. |
2b778ceb | 2 | Copyright (C) 2020-2021 Free Software Foundation, Inc. |
0e7d930c VG |
3 | |
4 | This file is part of the GNU C Library. | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
17 | License along with the GNU C Library. If not, see | |
18 | <https://www.gnu.org/licenses/>. */ | |
19 | ||
20 | ||
21 | /* For now. */ | |
22 | #define TLS_LD(x) TLS_IE(x) | |
23 | ||
24 | #define TLS_GD(x) \ | |
25 | ({ void *__result; \ | |
26 | __asm__ ("add r0, pcl, @" #x "@tlsgd \n" \ | |
27 | ".tls_gd_ld " #x "`bl __tls_get_addr@plt \n" \ | |
28 | "mov %0, r0 \n" \ | |
29 | : "=&r" (__result) \ | |
30 | ::"r0","r1","r2","r3","r4","r5","r6","r7", \ | |
31 | "r8","r9","r10","r11","r12"); \ | |
32 | __result; }) | |
33 | ||
34 | #define TLS_LE(x) \ | |
35 | ({ void *__result; \ | |
36 | void *tp = __builtin_thread_pointer (); \ | |
37 | __asm__ ("add %0, %1, @" #x "@tpoff \n" \ | |
38 | : "=r" (__result) : "r"(tp)); \ | |
39 | __result; }) | |
40 | ||
41 | #define TLS_IE(x) \ | |
42 | ({ void *__result; \ | |
43 | void *tp = __builtin_thread_pointer (); \ | |
44 | __asm__ ("ld %0, [pcl, @" #x "@tlsie] \n" \ | |
45 | "add %0, %1, %0 \n" \ | |
46 | : "=&r" (__result) : "r" (tp)); \ | |
47 | __result; }) |