patches/glibc/ports-2.10.1/450-alpha-ptr-mangling.patch
author Arnaud Lacombe <lacombar@gmail.com>
Thu Aug 05 17:59:51 2010 +0200 (2010-08-05)
changeset 2069 366bd2b22675
permissions -rw-r--r--
complibs/mpc: fix MPC 0.8.1 build with MPFR 3.0.0

This is the change introduced by revision 734 of MPC repository.

Author: Paul Zimmermann <Paul.Zimmermann@loria.fr>
Revision log: [acos.c] fixed problem with GMP_RNDA (should be MPFR_RNDA, and code was wrong)

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