]>
Commit | Line | Data |
---|---|---|
6d8ac728 PS |
1 | Additional Comment #5 From Pierre Habouzit 2007-11-02 08:2012 |
2 | ||
3 | Subject: Re: glibc 2.7 compilation problem on alpha due to PTR_MANGLE and PTR_DEMANGLE | |
4 | On Sun, Oct 28, 2007 at 09:47:59PM +0000, jciccone at gmail dot com wrote: | |
5 | > | |
6 | > ------- Additional Comments From jciccone at gmail dot com 2007-10-28 19:47 ------- | |
7 | > Created an attachment (id=2062) | |
8 | > --> (http://sourceware.org/bugzilla/attachment.cgi?id=2062&action=view) | |
9 | > patch that moves PTR_MANGLE for alpha | |
10 | ||
11 | > Also, in every architecture besides alpha, the #if defined NOT_IN_libc && | |
12 | > defined IS_IN_rtld contition has #else. alpha has a #elif defined PIC. The | |
13 | > attached patch changes that #elif defined PIC to a #else. | |
14 | ||
15 | The thing is, in non PIC mode, rtld.o is not in the libc.a (or hasn't | |
16 | the symbol that the libc uses for PTR_MANGLE which is the same), so PIC | |
17 | is definitely special cased. | |
18 | ||
19 | Attached is a patch that fixes the issue for Debian, and let alpha | |
20 | build, at the expense of disabling MANGLING in the non PIC case, but | |
21 | googling showed that the issue is known, and that nobody really cares | |
22 | about it. | |
23 | ||
24 | --- glibc-2.7.orig/sysdeps/unix/alpha/sysdep.h | |
25 | +++ glibc-2.7/sysdeps/unix/alpha/sysdep.h | |
6f56fb05 PS |
26 | @@ -397,42 +397,4 @@ |
27 | _sc_ret = _sc_0, _sc_err = _sc_19; \ | |
28 | } | |
29 | ||
30 | -/* Pointer mangling support. Note that tls access is slow enough that | |
31 | - we don't deoptimize things by placing the pointer check value there. */ | |
32 | - | |
33 | -#include <stdint.h> | |
34 | - | |
35 | -#if defined NOT_IN_libc && defined IS_IN_rtld | |
36 | -# ifdef __ASSEMBLER__ | |
37 | -# define PTR_MANGLE(dst, src, tmp) \ | |
38 | - ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ | |
39 | - ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ | |
40 | - xor src, tmp, dst | |
41 | -# define PTR_MANGLE2(dst, src, tmp) \ | |
42 | - xor src, tmp, dst | |
43 | -# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) | |
44 | -# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) | |
45 | -# else | |
46 | -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; | |
47 | -# define PTR_MANGLE(var) \ | |
48 | - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) | |
49 | -# define PTR_DEMANGLE(var) PTR_MANGLE(var) | |
50 | -# endif | |
51 | -#elif defined PIC | |
52 | -# ifdef __ASSEMBLER__ | |
53 | -# define PTR_MANGLE(dst, src, tmp) \ | |
54 | - ldq tmp, __pointer_chk_guard; \ | |
55 | - xor src, tmp, dst | |
56 | -# define PTR_MANGLE2(dst, src, tmp) \ | |
57 | - xor src, tmp, dst | |
58 | -# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) | |
59 | -# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) | |
60 | -# else | |
61 | -extern uintptr_t __pointer_chk_guard attribute_relro; | |
62 | -# define PTR_MANGLE(var) \ | |
63 | - (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) | |
64 | -# define PTR_DEMANGLE(var) PTR_MANGLE(var) | |
65 | -# endif | |
66 | -#endif | |
67 | - | |
68 | #endif /* ASSEMBLER */ | |
6d8ac728 PS |
69 | --- glibc-2.7.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h |
70 | +++ glibc-2.7/sysdeps/unix/sysv/linux/alpha/sysdep.h | |
71 | @@ -98,4 +98,46 @@ | |
6f56fb05 PS |
72 | INTERNAL_SYSCALL1(name, err_out, nr, args); \ |
73 | }) | |
74 | ||
6d8ac728 PS |
75 | +/* Pointer mangling support. Note that tls access is slow enough that |
76 | + we don't deoptimize things by placing the pointer check value there. */ | |
77 | + | |
6f56fb05 PS |
78 | +#if defined NOT_IN_libc && defined IS_IN_rtld |
79 | +# ifdef __ASSEMBLER__ | |
6d8ac728 PS |
80 | +# define PTR_MANGLE(dst, src, tmp) \ |
81 | + ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ | |
82 | + ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ | |
83 | + xor src, tmp, dst | |
84 | +# define PTR_MANGLE2(dst, src, tmp) \ | |
85 | + xor src, tmp, dst | |
6f56fb05 PS |
86 | +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) |
87 | +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) | |
88 | +# else | |
89 | +extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; | |
6d8ac728 | 90 | +# define PTR_MANGLE(var) \ |
6f56fb05 PS |
91 | + (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) |
92 | +# define PTR_DEMANGLE(var) PTR_MANGLE(var) | |
93 | +# endif | |
6d8ac728 | 94 | +#elif defined PIC |
6f56fb05 | 95 | +# ifdef __ASSEMBLER__ |
6d8ac728 PS |
96 | +# define PTR_MANGLE(dst, src, tmp) \ |
97 | + ldq tmp, __pointer_chk_guard; \ | |
98 | + xor src, tmp, dst | |
99 | +# define PTR_MANGLE2(dst, src, tmp) \ | |
100 | + xor src, tmp, dst | |
6f56fb05 PS |
101 | +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) |
102 | +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) | |
103 | +# else | |
104 | +extern uintptr_t __pointer_chk_guard attribute_relro; | |
6d8ac728 PS |
105 | +# define PTR_MANGLE(var) \ |
106 | + (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) | |
6f56fb05 PS |
107 | +# define PTR_DEMANGLE(var) PTR_MANGLE(var) |
108 | +# endif | |
6d8ac728 PS |
109 | +#else |
110 | +/* Pointer mangling is not yet supported for static libc on alpha. */ | |
111 | +# ifndef __ASSEMBLER__ | |
112 | +# define PTR_MANGLE(var) (void) (var) | |
113 | +# define PTR_DEMANGLE(var) (void) (var) | |
114 | +# endif | |
6f56fb05 PS |
115 | +#endif |
116 | + | |
117 | #endif /* _LINUX_ALPHA_SYSDEP_H */ |