aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-05-11 14:35:56 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-05-11 14:35:56 -0700
commit4822a2a5207d0aa43160a7a95cb1ac244a350511 (patch)
tree9c57fb8d37fac8ac5cd6293e6ffbd6d125890014
parent60d45b36a5cf5befde06d44424c720edf1f88244 (diff)
downloadglibc-4822a2a5207d0aa43160a7a95cb1ac244a350511.tar
glibc-4822a2a5207d0aa43160a7a95cb1ac244a350511.tar.gz
glibc-4822a2a5207d0aa43160a7a95cb1ac244a350511.tar.bz2
glibc-4822a2a5207d0aa43160a7a95cb1ac244a350511.zip
Add x32 support to TLS_LE/TLS_IE/TLS_GD
-rw-r--r--ChangeLog9
-rw-r--r--elf/tls-macros.h16
2 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d3a2a8e51b..9d8a7136c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-05-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf/tls-macros.h (TLS_LE): Use mov instead of movq to load
+ thread pointer.
+ (TLS_IE): Use mov/add instead of movq/addq to load thread
+ pointer.
+ (TLS_GD_PREFIX): New.
+ (TLS_GD): Use it.
+
2012-05-11 David S. Miller <davem@davemloft.net>
* sysdeps/sparc/fpu/bits/fenv.h (__fenv_stfsr): Add __volatile__.
diff --git a/elf/tls-macros.h b/elf/tls-macros.h
index ea6f14f56b..e753d5ccaf 100644
--- a/elf/tls-macros.h
+++ b/elf/tls-macros.h
@@ -101,15 +101,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; })
@@ -122,9 +122,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" \