patches/glibc/2.6/200-alpha-ptr_mangle.patch
changeset 748 61cd4eb6034d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.6/200-alpha-ptr_mangle.patch	Mon Jul 28 21:59:40 2008 +0000
     1.3 @@ -0,0 +1,103 @@
     1.4 +--- glibc-2.6.orig/sysdeps/unix/alpha/sysdep.h
     1.5 ++++ glibc-2.6/sysdeps/unix/alpha/sysdep.h
     1.6 +@@ -397,42 +397,4 @@
     1.7 + 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
     1.8 + }
     1.9 + 
    1.10 +-/* Pointer mangling support.  Note that tls access is slow enough that
    1.11 +-   we don't deoptimize things by placing the pointer check value there.  */
    1.12 +-
    1.13 +-#include <stdint.h>
    1.14 +-
    1.15 +-#if defined NOT_IN_libc && defined IS_IN_rtld
    1.16 +-# ifdef __ASSEMBLER__
    1.17 +-#  define PTR_MANGLE(dst, src, tmp)				\
    1.18 +-	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
    1.19 +-	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
    1.20 +-	xor	src, tmp, dst
    1.21 +-#  define PTR_MANGLE2(dst, src, tmp)				\
    1.22 +-	xor	src, tmp, dst
    1.23 +-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
    1.24 +-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
    1.25 +-# else
    1.26 +-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
    1.27 +-#  define PTR_MANGLE(var)	\
    1.28 +-  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
    1.29 +-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
    1.30 +-# endif
    1.31 +-#elif defined PIC
    1.32 +-# ifdef __ASSEMBLER__
    1.33 +-#  define PTR_MANGLE(dst, src, tmp)		\
    1.34 +-	ldq	tmp, __pointer_chk_guard;	\
    1.35 +-	xor	src, tmp, dst
    1.36 +-#  define PTR_MANGLE2(dst, src, tmp)		\
    1.37 +-	xor	src, tmp, dst
    1.38 +-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
    1.39 +-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
    1.40 +-# else
    1.41 +-extern uintptr_t __pointer_chk_guard attribute_relro;
    1.42 +-#  define PTR_MANGLE(var)	\
    1.43 +-	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
    1.44 +-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
    1.45 +-# endif
    1.46 +-#endif
    1.47 +-
    1.48 + #endif /* ASSEMBLER */
    1.49 +--- glibc-2.6.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h
    1.50 ++++ glibc-2.6/sysdeps/unix/sysv/linux/alpha/sysdep.h
    1.51 +@@ -29,6 +29,8 @@
    1.52 + /* There is some commonality.  */
    1.53 + #include <sysdeps/unix/alpha/sysdep.h>
    1.54 + 
    1.55 ++#include <tls.h>
    1.56 ++
    1.57 + /* For Linux we can use the system call table in the header file
    1.58 + 	/usr/include/asm/unistd.h
    1.59 +    of the kernel.  But these symbols do not follow the SYS_* syntax
    1.60 +@@ -96,4 +96,46 @@
    1.61 + 	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
    1.62 + })
    1.63 + 
    1.64 ++/* Pointer mangling support.  Note that tls access is slow enough that
    1.65 ++   we don't deoptimize things by placing the pointer check value there.  */
    1.66 ++
    1.67 ++#if defined NOT_IN_libc && defined IS_IN_rtld
    1.68 ++# ifdef __ASSEMBLER__
    1.69 ++#  define PTR_MANGLE(dst, src, tmp)				\
    1.70 ++	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
    1.71 ++	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
    1.72 ++	xor	src, tmp, dst
    1.73 ++#  define PTR_MANGLE2(dst, src, tmp)				\
    1.74 ++	xor	src, tmp, dst
    1.75 ++#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
    1.76 ++#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
    1.77 ++# else
    1.78 ++extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
    1.79 ++#  define PTR_MANGLE(var)	\
    1.80 ++  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
    1.81 ++#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
    1.82 ++# endif
    1.83 ++#elif defined PIC
    1.84 ++# ifdef __ASSEMBLER__
    1.85 ++#  define PTR_MANGLE(dst, src, tmp)		\
    1.86 ++	ldq	tmp, __pointer_chk_guard;	\
    1.87 ++	xor	src, tmp, dst
    1.88 ++#  define PTR_MANGLE2(dst, src, tmp)		\
    1.89 ++	xor	src, tmp, dst
    1.90 ++#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
    1.91 ++#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
    1.92 ++# else
    1.93 ++extern uintptr_t __pointer_chk_guard attribute_relro;
    1.94 ++#  define PTR_MANGLE(var)	\
    1.95 ++	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
    1.96 ++#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
    1.97 ++# endif
    1.98 ++#else
    1.99 ++/* Pointer mangling is not yet supported for static libc on alpha.  */
   1.100 ++# ifndef __ASSEMBLER__
   1.101 ++#  define PTR_MANGLE(var)   (void) (var)
   1.102 ++#  define PTR_DEMANGLE(var) (void) (var)
   1.103 ++# endif
   1.104 ++#endif
   1.105 ++
   1.106 + #endif /* _LINUX_ALPHA_SYSDEP_H */