1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/ports-2.10.1/450-alpha-ptr-mangling.patch Sun Sep 12 23:38:18 2010 +0200
1.3 @@ -0,0 +1,111 @@
1.4 +http://bugs.gentoo.org/201910
1.5 +
1.6 +For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
1.7 +sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
1.8 +defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
1.9 +includes the first.
1.10 +
1.11 +This is a patch that fixes the issue and let alpha build, at the expense of
1.12 +disabling MANGLING in the non PIC case, but googling showed that the issue is
1.13 +known, and that nobody really cares about it.
1.14 +
1.15 +Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
1.16 +
1.17 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h
1.18 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h 2009-05-16 10:36:20.000000000 +0200
1.19 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h 2009-11-13 00:50:55.000000000 +0100
1.20 +@@ -397,42 +397,4 @@
1.21 + _sc_ret = _sc_0, _sc_err = _sc_19; \
1.22 + }
1.23 +
1.24 +-/* Pointer mangling support. Note that tls access is slow enough that
1.25 +- we don't deoptimize things by placing the pointer check value there. */
1.26 +-
1.27 +-#include <stdint.h>
1.28 +-
1.29 +-#if defined NOT_IN_libc && defined IS_IN_rtld
1.30 +-# ifdef __ASSEMBLER__
1.31 +-# define PTR_MANGLE(dst, src, tmp) \
1.32 +- ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
1.33 +- ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
1.34 +- xor src, tmp, dst
1.35 +-# define PTR_MANGLE2(dst, src, tmp) \
1.36 +- xor src, tmp, dst
1.37 +-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
1.38 +-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
1.39 +-# else
1.40 +-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
1.41 +-# define PTR_MANGLE(var) \
1.42 +- (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
1.43 +-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
1.44 +-# endif
1.45 +-#elif defined PIC
1.46 +-# ifdef __ASSEMBLER__
1.47 +-# define PTR_MANGLE(dst, src, tmp) \
1.48 +- ldq tmp, __pointer_chk_guard; \
1.49 +- xor src, tmp, dst
1.50 +-# define PTR_MANGLE2(dst, src, tmp) \
1.51 +- xor src, tmp, dst
1.52 +-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
1.53 +-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
1.54 +-# else
1.55 +-extern uintptr_t __pointer_chk_guard attribute_relro;
1.56 +-# define PTR_MANGLE(var) \
1.57 +- (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
1.58 +-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
1.59 +-# endif
1.60 +-#endif
1.61 +-
1.62 + #endif /* ASSEMBLER */
1.63 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h
1.64 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h 2009-05-16 10:36:20.000000000 +0200
1.65 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h 2009-11-13 00:50:55.000000000 +0100
1.66 +@@ -98,4 +98,46 @@
1.67 + INTERNAL_SYSCALL1(name, err_out, nr, args); \
1.68 + })
1.69 +
1.70 ++/* Pointer mangling support. Note that tls access is slow enough that
1.71 ++ we don't deoptimize things by placing the pointer check value there. */
1.72 ++
1.73 ++#if defined NOT_IN_libc && defined IS_IN_rtld
1.74 ++# ifdef __ASSEMBLER__
1.75 ++# define PTR_MANGLE(dst, src, tmp) \
1.76 ++ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
1.77 ++ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
1.78 ++ xor src, tmp, dst
1.79 ++# define PTR_MANGLE2(dst, src, tmp) \
1.80 ++ xor src, tmp, dst
1.81 ++# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
1.82 ++# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
1.83 ++# else
1.84 ++extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
1.85 ++# define PTR_MANGLE(var) \
1.86 ++ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
1.87 ++# define PTR_DEMANGLE(var) PTR_MANGLE(var)
1.88 ++# endif
1.89 ++#elif defined PIC
1.90 ++# ifdef __ASSEMBLER__
1.91 ++# define PTR_MANGLE(dst, src, tmp) \
1.92 ++ ldq tmp, __pointer_chk_guard; \
1.93 ++ xor src, tmp, dst
1.94 ++# define PTR_MANGLE2(dst, src, tmp) \
1.95 ++ xor src, tmp, dst
1.96 ++# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
1.97 ++# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
1.98 ++# else
1.99 ++extern uintptr_t __pointer_chk_guard attribute_relro;
1.100 ++# define PTR_MANGLE(var) \
1.101 ++ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
1.102 ++# define PTR_DEMANGLE(var) PTR_MANGLE(var)
1.103 ++# endif
1.104 ++#else
1.105 ++/* Pointer mangling is not yet supported for static libc on alpha. */
1.106 ++# ifndef __ASSEMBLER__
1.107 ++# define PTR_MANGLE(var) (void) (var)
1.108 ++# define PTR_DEMANGLE(var) (void) (var)
1.109 ++# endif
1.110 ++#endif
1.111 ++
1.112 + #endif /* _LINUX_ALPHA_SYSDEP_H */
1.113 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/alpha/sysdep.h glibc-2.10.1/ports/sysdeps/unix/alpha/sysdep.h
1.114 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h