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