summaryrefslogtreecommitdiff
path: root/test/tls/tls-macros.h
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-12-13 23:51:12 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2015-12-17 20:35:20 +0100
commit8340ffd2997feaca9074e0272e3c4663793baf77 (patch)
tree21dc0ffcc0b26fbe33d36c4e32bf726db6f1ce6d /test/tls/tls-macros.h
parentcc04ab27ba6341f46bbe094478c9af3e3706f411 (diff)
test/tls: tls-macros*.h fixes from glibc
glibc commits 4822a2a520 Add x32 support to TLS_LE/TLS_IE/TLS_GD 63fb881a04 tls-macros-mips.h: Load $gp as required. Merge 32-bit and 64-bit versions. Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Diffstat (limited to 'test/tls/tls-macros.h')
-rw-r--r--test/tls/tls-macros.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h
index d2437431c..e4d87f26d 100644
--- a/test/tls/tls-macros.h
+++ b/test/tls/tls-macros.h
@@ -111,15 +111,15 @@
# define TLS_LE(x) \
({ int *__l; \
- __asm__ ("movq %%fs:0,%0\n\t" \
- "leaq " #x "@tpoff(%0), %0" \
+ __asm__ ("mov %%fs:0,%0\n\t" \
+ "lea " #x "@tpoff(%0), %0" \
: "=r" (__l)); \
__l; })
# define TLS_IE(x) \
({ int *__l; \
- __asm__ ("movq %%fs:0,%0\n\t" \
- "addq " #x "@gottpoff(%%rip),%0" \
+ __asm__ ("mov %%fs:0,%0\n\t" \
+ "add " #x "@gottpoff(%%rip),%0" \
: "=r" (__l)); \
__l; })
@@ -132,9 +132,15 @@
: : "rdi", "rsi", "r8", "r9", "r10", "r11"); \
__l; })
+# ifdef __ILP32__
+# define TLS_GD_PREFIX
+# else
+# define TLS_GD_PREFIX ".byte 0x66\n\t"
+# endif
+
# define TLS_GD(x) \
({ int *__l, __c, __d; \
- __asm__ (".byte 0x66\n\t" \
+ __asm__ (TLS_GD_PREFIX \
"leaq " #x "@tlsgd(%%rip),%%rdi\n\t" \
".word 0x6666\n\t" \
"rex64\n\t" \