patches/glibc/2.9/490-ptr-mangling.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun May 03 09:50:16 2009 +0000 (2009-05-03)
branchnewlib
changeset 1366 5e5d1e6f55d3
permissions -rw-r--r--
Update the newlib devel branch with stuff from /trunk@1498.

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