patches/glibc/2.9/490-ptr-mangling.patch
author Michael Hope <michael.hope@linaro.org>
Wed Oct 19 15:27:32 2011 +1300 (2011-10-19)
changeset 2739 f320e22f2cba
parent 1201 c9967a6e3b25
permissions -rw-r--r--
arch: add softfp support

Some architectures support a mixed hard/soft floating point, where
the compiler emits hardware floating point instructions, but passes
the operands in core (aka integer) registers.

For example, ARM supports this mode (to come in the next changeset).

Add support for softfp cross compilers to the GCC and GLIBC
configuration. Needed for Ubuntu and other distros that are softfp.

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