patches/glibc/2.6/200-alpha-ptr_mangle.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
yann@748
     1
--- glibc-2.6.orig/sysdeps/unix/alpha/sysdep.h
yann@748
     2
+++ glibc-2.6/sysdeps/unix/alpha/sysdep.h
yann@748
     3
@@ -397,42 +397,4 @@
yann@748
     4
 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
yann@748
     5
 }
yann@748
     6
 
yann@748
     7
-/* Pointer mangling support.  Note that tls access is slow enough that
yann@748
     8
-   we don't deoptimize things by placing the pointer check value there.  */
yann@748
     9
-
yann@748
    10
-#include <stdint.h>
yann@748
    11
-
yann@748
    12
-#if defined NOT_IN_libc && defined IS_IN_rtld
yann@748
    13
-# ifdef __ASSEMBLER__
yann@748
    14
-#  define PTR_MANGLE(dst, src, tmp)				\
yann@748
    15
-	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
yann@748
    16
-	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
yann@748
    17
-	xor	src, tmp, dst
yann@748
    18
-#  define PTR_MANGLE2(dst, src, tmp)				\
yann@748
    19
-	xor	src, tmp, dst
yann@748
    20
-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
yann@748
    21
-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
yann@748
    22
-# else
yann@748
    23
-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
yann@748
    24
-#  define PTR_MANGLE(var)	\
yann@748
    25
-  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
yann@748
    26
-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
yann@748
    27
-# endif
yann@748
    28
-#elif defined PIC
yann@748
    29
-# ifdef __ASSEMBLER__
yann@748
    30
-#  define PTR_MANGLE(dst, src, tmp)		\
yann@748
    31
-	ldq	tmp, __pointer_chk_guard;	\
yann@748
    32
-	xor	src, tmp, dst
yann@748
    33
-#  define PTR_MANGLE2(dst, src, tmp)		\
yann@748
    34
-	xor	src, tmp, dst
yann@748
    35
-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
yann@748
    36
-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
yann@748
    37
-# else
yann@748
    38
-extern uintptr_t __pointer_chk_guard attribute_relro;
yann@748
    39
-#  define PTR_MANGLE(var)	\
yann@748
    40
-	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
yann@748
    41
-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
yann@748
    42
-# endif
yann@748
    43
-#endif
yann@748
    44
-
yann@748
    45
 #endif /* ASSEMBLER */
yann@748
    46
--- glibc-2.6.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h
yann@748
    47
+++ glibc-2.6/sysdeps/unix/sysv/linux/alpha/sysdep.h
yann@748
    48
@@ -29,6 +29,8 @@
yann@748
    49
 /* There is some commonality.  */
yann@748
    50
 #include <sysdeps/unix/alpha/sysdep.h>
yann@748
    51
 
yann@748
    52
+#include <tls.h>
yann@748
    53
+
yann@748
    54
 /* For Linux we can use the system call table in the header file
yann@748
    55
 	/usr/include/asm/unistd.h
yann@748
    56
    of the kernel.  But these symbols do not follow the SYS_* syntax
yann@748
    57
@@ -96,4 +96,46 @@
yann@748
    58
 	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
yann@748
    59
 })
yann@748
    60
 
yann@748
    61
+/* Pointer mangling support.  Note that tls access is slow enough that
yann@748
    62
+   we don't deoptimize things by placing the pointer check value there.  */
yann@748
    63
+
yann@748
    64
+#if defined NOT_IN_libc && defined IS_IN_rtld
yann@748
    65
+# ifdef __ASSEMBLER__
yann@748
    66
+#  define PTR_MANGLE(dst, src, tmp)				\
yann@748
    67
+	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
yann@748
    68
+	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
yann@748
    69
+	xor	src, tmp, dst
yann@748
    70
+#  define PTR_MANGLE2(dst, src, tmp)				\
yann@748
    71
+	xor	src, tmp, dst
yann@748
    72
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
yann@748
    73
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
yann@748
    74
+# else
yann@748
    75
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
yann@748
    76
+#  define PTR_MANGLE(var)	\
yann@748
    77
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
yann@748
    78
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
yann@748
    79
+# endif
yann@748
    80
+#elif defined PIC
yann@748
    81
+# ifdef __ASSEMBLER__
yann@748
    82
+#  define PTR_MANGLE(dst, src, tmp)		\
yann@748
    83
+	ldq	tmp, __pointer_chk_guard;	\
yann@748
    84
+	xor	src, tmp, dst
yann@748
    85
+#  define PTR_MANGLE2(dst, src, tmp)		\
yann@748
    86
+	xor	src, tmp, dst
yann@748
    87
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
yann@748
    88
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
yann@748
    89
+# else
yann@748
    90
+extern uintptr_t __pointer_chk_guard attribute_relro;
yann@748
    91
+#  define PTR_MANGLE(var)	\
yann@748
    92
+	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
yann@748
    93
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
yann@748
    94
+# endif
yann@748
    95
+#else
yann@748
    96
+/* Pointer mangling is not yet supported for static libc on alpha.  */
yann@748
    97
+# ifndef __ASSEMBLER__
yann@748
    98
+#  define PTR_MANGLE(var)   (void) (var)
yann@748
    99
+#  define PTR_DEMANGLE(var) (void) (var)
yann@748
   100
+# endif
yann@748
   101
+#endif
yann@748
   102
+
yann@748
   103
 #endif /* _LINUX_ALPHA_SYSDEP_H */