diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-01-25 15:14:00 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-03-01 14:07:54 -0800 |
commit | a43c8143e728159c31223da5c0d25dd94e6a3379 (patch) | |
tree | ab8b7b7642ca235848310f0719feabe6e79e2fe0 | |
parent | 4d3a716cfed39cec4f77fd0fce4bbd004fa72a43 (diff) | |
download | glibc-a43c8143e728159c31223da5c0d25dd94e6a3379.tar.gz glibc-a43c8143e728159c31223da5c0d25dd94e6a3379.tar.xz glibc-a43c8143e728159c31223da5c0d25dd94e6a3379.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.x32 | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/sysdep.h | 32 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h | 42 |
3 files changed, 24 insertions, 58 deletions
diff --git a/ChangeLog.x32 b/ChangeLog.x32 index 8606e241d2..584c79ba21 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 376a98e91c..1de59b9720 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -384,33 +384,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 486c30d300..ea3663b37e 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h @@ -87,46 +87,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 */ |