1 Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_glibc-ptr-mangling.patch
3 -= BEGIN original header =-
4 http://bugs.gentoo.org/201910
6 For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
7 sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
8 defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
11 This is a patch that fixes the issue and let alpha build, at the expense of
12 disabling MANGLING in the non PIC case, but googling showed that the issue is
13 known, and that nobody really cares about it.
15 Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
17 -= END original header =-
19 diff -durN glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h glibc-2_9/sysdeps/unix/alpha/sysdep.h
20 --- glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h 2006-03-03 12:21:28.000000000 +0100
21 +++ glibc-2_9/sysdeps/unix/alpha/sysdep.h 2009-02-02 22:01:39.000000000 +0100
23 _sc_ret = _sc_0, _sc_err = _sc_19; \
26 -/* Pointer mangling support. Note that tls access is slow enough that
27 - we don't deoptimize things by placing the pointer check value there. */
31 -#if defined NOT_IN_libc && defined IS_IN_rtld
32 -# ifdef __ASSEMBLER__
33 -# define PTR_MANGLE(dst, src, tmp) \
34 - ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
35 - ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
37 -# define PTR_MANGLE2(dst, src, tmp) \
39 -# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
40 -# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
42 -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
43 -# define PTR_MANGLE(var) \
44 - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
45 -# define PTR_DEMANGLE(var) PTR_MANGLE(var)
48 -# ifdef __ASSEMBLER__
49 -# define PTR_MANGLE(dst, src, tmp) \
50 - ldq tmp, __pointer_chk_guard; \
52 -# define PTR_MANGLE2(dst, src, tmp) \
54 -# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
55 -# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
57 -extern uintptr_t __pointer_chk_guard attribute_relro;
58 -# define PTR_MANGLE(var) \
59 - (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
60 -# define PTR_DEMANGLE(var) PTR_MANGLE(var)
64 #endif /* ASSEMBLER */
65 diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h
66 --- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h 2007-08-21 10:07:28.000000000 +0200
67 +++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h 2009-02-02 22:01:39.000000000 +0100
69 INTERNAL_SYSCALL1(name, err_out, nr, args); \
72 +/* Pointer mangling support. Note that tls access is slow enough that
73 + we don't deoptimize things by placing the pointer check value there. */
75 +#if defined NOT_IN_libc && defined IS_IN_rtld
76 +# ifdef __ASSEMBLER__
77 +# define PTR_MANGLE(dst, src, tmp) \
78 + ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
79 + ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
81 +# define PTR_MANGLE2(dst, src, tmp) \
83 +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
84 +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
86 +extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
87 +# define PTR_MANGLE(var) \
88 + (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
89 +# define PTR_DEMANGLE(var) PTR_MANGLE(var)
92 +# ifdef __ASSEMBLER__
93 +# define PTR_MANGLE(dst, src, tmp) \
94 + ldq tmp, __pointer_chk_guard; \
96 +# define PTR_MANGLE2(dst, src, tmp) \
98 +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
99 +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
101 +extern uintptr_t __pointer_chk_guard attribute_relro;
102 +# define PTR_MANGLE(var) \
103 + (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
104 +# define PTR_DEMANGLE(var) PTR_MANGLE(var)
107 +/* Pointer mangling is not yet supported for static libc on alpha. */
108 +# ifndef __ASSEMBLER__
109 +# define PTR_MANGLE(var) (void) (var)
110 +# define PTR_DEMANGLE(var) (void) (var)
114 #endif /* _LINUX_ALPHA_SYSDEP_H */