This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Remove the `q' suffix in x86_64 PTR_MANGLE/PTR_DEMANGLE
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 16 Mar 2012 15:26:21 -0700
- Subject: PATCH: Remove the `q' suffix in x86_64 PTR_MANGLE/PTR_DEMANGLE
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch removes the `q' suffix from xor/rol instructions in x86_64
PTR_MANGLE PTR_DEMANGLE so that they work with both 32bit registers under
x32 and 64bit registers under x86-64. OK to install?
Thanks.
H.J.
---
2012-03-16 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.
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index c9c4dbd..dc9c5fe 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -342,33 +352,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, \