about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-01-25 15:14:00 -0800
committerH.J. Lu <hjl.tools@gmail.com>2012-05-27 07:30:56 -0700
commit29d22497253f63627626829b4330075931161260 (patch)
treedccbeaf74cc2c8fe92b72216ddab9ced701795c5
parentc9eeae9105d40de9930439228767cc3c2583f49d (diff)
downloadglibc-29d22497253f63627626829b4330075931161260.tar.gz
glibc-29d22497253f63627626829b4330075931161260.tar.xz
glibc-29d22497253f63627626829b4330075931161260.zip
Remove x32 PTR_MANGLE/PTR_DEMANGLE
Remove the `q' suffix from x86-64 xor/rol instructions so that they
work for both x86-64 and x32.
-rw-r--r--ChangeLog.x328
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h32
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h42
3 files changed, 24 insertions, 58 deletions
diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 0e35a1fb17..66e473ccd0 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,11 @@
+2012-02-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Remove
+	the `q' suffix from xor/rol instructions.
+	(PTR_DEMANGLE): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (PTR_MANGLE): Removed.
+	(PTR_DEMANGLE): Likewise.
+
 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* malloc/malloc.c (sYSMALLOc): Free the old top chunk with a
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 1e68cf1da2..48c74a1818 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -353,33 +353,33 @@
 /* We cannot use the thread descriptor because in ld.so we use setjmp
    earlier than the descriptor is initialized.  */
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorq __pointer_chk_guard_local(%rip), reg;    \
-				rolq $17, reg
-#  define PTR_DEMANGLE(reg)	rorq $17, reg;				      \
-				xorq __pointer_chk_guard_local(%rip), reg
+#  define PTR_MANGLE(reg)	xor __pointer_chk_guard_local(%rip), reg;    \
+				rol $17, reg
+#  define PTR_DEMANGLE(reg)	ror $17, reg;				      \
+				xor __pointer_chk_guard_local(%rip), reg
 # else
-#  define PTR_MANGLE(reg)	asm ("xorq __pointer_chk_guard_local(%%rip), %0\n" \
-				     "rolq $17, %0"			      \
+#  define PTR_MANGLE(reg)	asm ("xor __pointer_chk_guard_local(%%rip), %0\n" \
+				     "rol $17, %0"			      \
 				     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)	asm ("rorq $17, %0\n"			      \
-				     "xorq __pointer_chk_guard_local(%%rip), %0" \
+#  define PTR_DEMANGLE(reg)	asm ("ror $17, %0\n"			      \
+				     "xor __pointer_chk_guard_local(%%rip), %0" \
 				     : "=r" (reg) : "0" (reg))
 # endif
 #else
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorq %fs:POINTER_GUARD, reg;		      \
-				rolq $17, reg
-#  define PTR_DEMANGLE(reg)	rorq $17, reg;				      \
-				xorq %fs:POINTER_GUARD, reg
+#  define PTR_MANGLE(reg)	xor %fs:POINTER_GUARD, reg;		      \
+				rol $17, reg
+#  define PTR_DEMANGLE(reg)	ror $17, reg;				      \
+				xor %fs:POINTER_GUARD, reg
 # else
-#  define PTR_MANGLE(var)	asm ("xorq %%fs:%c2, %0\n"		      \
-				     "rolq $17, %0"			      \
+#  define PTR_MANGLE(var)	asm ("xor %%fs:%c2, %0\n"		      \
+				     "rol $17, %0"			      \
 				     : "=r" (var)			      \
 				     : "0" (var),			      \
 				       "i" (offsetof (tcbhead_t,	      \
 						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	asm ("rorq $17, %0\n"			      \
-				     "xorq %%fs:%c2, %0"		      \
+#  define PTR_DEMANGLE(var)	asm ("ror $17, %0\n"			      \
+				     "xor %%fs:%c2, %0"		      \
 				     : "=r" (var)			      \
 				     : "0" (var),			      \
 				       "i" (offsetof (tcbhead_t,	      \
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
index 81b2dbe063..15b67b4c91 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
@@ -57,46 +57,4 @@
 
 #endif	/* __ASSEMBLER__ */
 
-/* Pointer mangling support.  */
-#undef PTR_MANGLE
-#undef PTR_DEMANGLE
-
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
-   earlier than the descriptor is initialized.  */
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorl __pointer_chk_guard_local(%rip), reg;    \
-				roll $17, reg
-#  define PTR_DEMANGLE(reg)	rorl $17, reg;				      \
-				xorl __pointer_chk_guard_local(%rip), reg
-# else
-#  define PTR_MANGLE(reg)	asm ("xorl __pointer_chk_guard_local(%%rip), %0\n" \
-				     "roll $17, %0"			      \
-				     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)	asm ("rorl $17, %0\n"			      \
-				     "xorl __pointer_chk_guard_local(%%rip), %0" \
-				     : "=r" (reg) : "0" (reg))
-# endif
-#else
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorl %fs:POINTER_GUARD, reg;		      \
-				roll $17, reg
-#  define PTR_DEMANGLE(reg)	rorl $17, reg;				      \
-				xorl %fs:POINTER_GUARD, reg
-# else
-#  define PTR_MANGLE(var)	asm ("xorl %%fs:%c2, %0\n"		      \
-				     "roll $17, %0"			      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	asm ("rorl $17, %0\n"			      \
-				     "xorl %%fs:%c2, %0"		      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-# endif
-#endif
-
 #endif /* linux/x86_64/x32/sysdep.h */