about summary refs log tree commit diff
path: root/nptl/sysdeps/x86_64/tls.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-12 20:32:01 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-12 20:32:01 +0000
commit177d1ad3ac9aab9b8ae7e7f70c2c66b6bdb876ee (patch)
tree14a7365c1e51d7195303a37d0b8fc17677a5b831 /nptl/sysdeps/x86_64/tls.h
parent68107ec092e7cc3fcd1f56edf9da8085cffed00d (diff)
downloadglibc-177d1ad3ac9aab9b8ae7e7f70c2c66b6bdb876ee.tar.gz
glibc-177d1ad3ac9aab9b8ae7e7f70c2c66b6bdb876ee.tar.xz
glibc-177d1ad3ac9aab9b8ae7e7f70c2c66b6bdb876ee.zip
Update.
2003-04-12  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/x86_64/tls.h (THREAD_SETMEM): Word around compiler bug
	which mishandles loading of global object addresses in PIC.
	(THREAD_SETMEM_NC): Likewise.
Diffstat (limited to 'nptl/sysdeps/x86_64/tls.h')
-rw-r--r--nptl/sysdeps/x86_64/tls.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index dec1b5d1b7..975d20f3fa 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -204,6 +204,15 @@ typedef struct
      __value; })
 
 
+/* Loading addresses of objects on x86-64 needs to be treated special
+   when generating PIC code.  */
+#ifdef __pic__
+# define IMM_MODE "nr"
+#else
+# define IMM_MODE "ir"
+#endif
+
+
 /* Same as THREAD_SETMEM, but the member offset can be non-constant.  */
 # define THREAD_SETMEM(descr, member, value) \
   ({ if (sizeof (descr->member) == 1)					      \
@@ -212,7 +221,7 @@ typedef struct
 		       "i" (offsetof (struct pthread, member)));	      \
      else if (sizeof (descr->member) == 4)				      \
        asm volatile ("movl %0,%%fs:%P1" :				      \
-		     : "ir" (value),					      \
+		     : IMM_MODE (value),				      \
 		       "i" (offsetof (struct pthread, member)));	      \
      else								      \
        {								      \
@@ -222,7 +231,7 @@ typedef struct
 	   abort ();							      \
 									      \
 	 asm volatile ("movq %q0,%%fs:%P1" :				      \
-		       : "ir" ((unsigned long int) value),		      \
+		       : IMM_MODE ((unsigned long int) value),		      \
 			 "i" (offsetof (struct pthread, member)));	      \
        }})
 
@@ -236,7 +245,7 @@ typedef struct
 		       "r" (idx));					      \
      else if (sizeof (descr->member[0]) == 4)				      \
        asm volatile ("movl %0,%%fs:%P1(,%q2,4)" :			      \
-		     : "ir" (value),					      \
+		     : IMM_MODE (value),				      \
 		       "i" (offsetof (struct pthread, member[0])),	      \
 		       "r" (idx));					      \
      else								      \
@@ -247,7 +256,7 @@ typedef struct
 	   abort ();							      \
 									      \
 	 asm volatile ("movq %q0,%%fs:%P1(,%q2,8)" :			      \
-		       : "r" ((unsigned long int) value),		      \
+		       : IMM_MODE ((unsigned long int) value),		      \
 			 "i" (offsetof (struct pthread, member[0])),	      \
 			 "r" (idx));					      \
        }})