From 5c8ae23aecdb14ee22ba06684c488cfe0306ff0e Mon Sep 17 00:00:00 2001 From: joseph Date: Tue, 6 Nov 2012 17:31:45 +0000 Subject: Merge changes between r21352 and r21563 from /fsf/trunk. git-svn-id: svn://svn.eglibc.org/trunk@21564 7b3dc134-2b1b-0410-93df-9e9f96275f8d --- libc/sysdeps/generic/math_private.h | 16 + libc/sysdeps/generic/paths.h | 6 +- libc/sysdeps/generic/tininess.h | 33 ++ libc/sysdeps/i386/fpu/fclrexcpt.c | 3 +- libc/sysdeps/i386/fpu/fenv_private.h | 23 ++ libc/sysdeps/ieee754/dbl-64/s_fma.c | 134 +++++-- libc/sysdeps/ieee754/ldbl-128/s_fmal.c | 137 +++++-- libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c | 3 +- libc/sysdeps/ieee754/ldbl-96/s_fma.c | 18 +- libc/sysdeps/ieee754/ldbl-96/s_fmal.c | 135 +++++-- libc/sysdeps/mach/hurd/Makefile | 10 +- libc/sysdeps/mach/hurd/bits/errno.h | 6 +- libc/sysdeps/mach/hurd/bits/param.h | 2 - libc/sysdeps/mach/hurd/fdatasync.c | 8 +- libc/sysdeps/mach/hurd/fsync.c | 8 +- libc/sysdeps/mach/hurd/i386/____longjmp_chk.S | 2 + libc/sysdeps/mach/hurd/powerpc/bits/sigcontext.h | 79 ---- libc/sysdeps/mach/hurd/powerpc/exc2signal.c | 73 ---- libc/sysdeps/mach/hurd/powerpc/init-first.c | 342 ---------------- libc/sysdeps/mach/hurd/powerpc/intr-msg.h | 98 ----- libc/sysdeps/mach/hurd/powerpc/longjmp-ts.c | 56 --- libc/sysdeps/mach/hurd/powerpc/register-dump.h | 119 ------ libc/sysdeps/mach/hurd/powerpc/sigreturn.c | 185 --------- libc/sysdeps/mach/hurd/powerpc/static-start.S | 58 --- libc/sysdeps/mach/hurd/powerpc/trampoline.c | 256 ------------ libc/sysdeps/mach/hurd/ptrace.c | 8 +- libc/sysdeps/mach/powerpc/machine-lock.h | 77 ---- libc/sysdeps/mach/powerpc/machine-sp.h | 41 -- libc/sysdeps/mach/powerpc/syscall.S | 29 -- libc/sysdeps/mach/powerpc/sysdep.h | 50 --- libc/sysdeps/mach/powerpc/thread_state.h | 38 -- libc/sysdeps/posix/getaddrinfo.c | 2 +- libc/sysdeps/powerpc/Makefile | 4 - libc/sysdeps/powerpc/bits/fenv.h | 137 ++++--- libc/sysdeps/powerpc/fpu/fclrexcpt.c | 3 +- libc/sysdeps/powerpc/fpu/libm-test-ulps | 440 ++++++++++++++++++++- libc/sysdeps/powerpc/sys/platform/ppc.h | 11 +- libc/sysdeps/pthread/aio_notify.c | 2 +- libc/sysdeps/s390/fpu/bits/fenv.h | 49 ++- libc/sysdeps/s390/fpu/fclrexcpt.c | 3 +- libc/sysdeps/s390/fpu/fegetenv.c | 4 +- libc/sysdeps/s390/fpu/feholdexcpt.c | 4 +- libc/sysdeps/s390/fpu/fesetenv.c | 12 +- libc/sysdeps/sh/sh4/fpu/bits/fenv.h | 37 +- libc/sysdeps/sh/sh4/fpu/fclrexcpt.c | 1 + libc/sysdeps/sh/tininess.h | 1 + libc/sysdeps/sparc/fpu/bits/fenv.h | 45 ++- libc/sysdeps/sparc/fpu/fclrexcpt.c | 3 +- libc/sysdeps/sparc/fpu/fenv_private.h | 12 + .../sparc32/sparcv9/multiarch/ifunc-impl-list.c | 1 + .../sparc/sparc64/multiarch/ifunc-impl-list.c | 75 ++++ libc/sysdeps/sparc/sparc64/multiarch/memcpy.S | 1 + libc/sysdeps/sparc/sparc64/multiarch/memset.S | 1 + libc/sysdeps/unix/Makefile | 1 - libc/sysdeps/unix/bsd/getpt.c | 1 - libc/sysdeps/unix/sysv/linux/epoll_pwait.c | 1 - libc/sysdeps/unix/sysv/linux/futimens.c | 1 - libc/sysdeps/unix/sysv/linux/lutimes.c | 1 - libc/sysdeps/unix/sysv/linux/paths.h | 4 +- .../linux/powerpc/powerpc32/fpu/nptl/libc.abilist | 2 +- .../sysv/linux/powerpc/powerpc64/makecontext.S | 30 +- .../sysv/linux/powerpc/powerpc64/nptl/libc.abilist | 2 +- .../sysv/linux/powerpc/powerpc64/sync_file_range.c | 2 - libc/sysdeps/unix/sysv/linux/readahead.c | 2 - libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h | 2 - .../unix/sysv/linux/sparc/sparc64/get_clockfreq.c | 6 +- libc/sysdeps/unix/sysv/linux/sync_file_range.c | 2 - libc/sysdeps/unix/sysv/linux/utimensat.c | 1 - libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h | 2 - libc/sysdeps/x86/Makefile | 4 + libc/sysdeps/x86/fpu/bits/fenv.h | 45 ++- libc/sysdeps/x86/tininess.h | 1 + libc/sysdeps/x86_64/fpu/fclrexcpt.c | 3 +- .../sysdeps/x86_64/multiarch/strcasestr-nonascii.c | 3 +- 74 files changed, 1172 insertions(+), 1845 deletions(-) create mode 100644 libc/sysdeps/generic/tininess.h delete mode 100644 libc/sysdeps/mach/hurd/powerpc/bits/sigcontext.h delete mode 100644 libc/sysdeps/mach/hurd/powerpc/exc2signal.c delete mode 100644 libc/sysdeps/mach/hurd/powerpc/init-first.c delete mode 100644 libc/sysdeps/mach/hurd/powerpc/intr-msg.h delete mode 100644 libc/sysdeps/mach/hurd/powerpc/longjmp-ts.c delete mode 100644 libc/sysdeps/mach/hurd/powerpc/register-dump.h delete mode 100644 libc/sysdeps/mach/hurd/powerpc/sigreturn.c delete mode 100644 libc/sysdeps/mach/hurd/powerpc/static-start.S delete mode 100644 libc/sysdeps/mach/hurd/powerpc/trampoline.c delete mode 100644 libc/sysdeps/mach/powerpc/machine-lock.h delete mode 100644 libc/sysdeps/mach/powerpc/machine-sp.h delete mode 100644 libc/sysdeps/mach/powerpc/syscall.S delete mode 100644 libc/sysdeps/mach/powerpc/sysdep.h delete mode 100644 libc/sysdeps/mach/powerpc/thread_state.h create mode 100644 libc/sysdeps/sh/tininess.h create mode 100644 libc/sysdeps/sparc/sparc32/sparcv9/multiarch/ifunc-impl-list.c create mode 100644 libc/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c create mode 100644 libc/sysdeps/x86/Makefile create mode 100644 libc/sysdeps/x86/tininess.h (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/generic/math_private.h b/libc/sysdeps/generic/math_private.h index b375bc0c5..7661788e6 100644 --- a/libc/sysdeps/generic/math_private.h +++ b/libc/sysdeps/generic/math_private.h @@ -401,6 +401,22 @@ default_libc_feholdexcept (fenv_t *e) # define libc_feholdexceptl default_libc_feholdexcept #endif +static __always_inline void +default_libc_fesetround (int r) +{ + (void) fesetround (r); +} + +#ifndef libc_fesetround +# define libc_fesetround default_libc_fesetround +#endif +#ifndef libc_fesetroundf +# define libc_fesetroundf default_libc_fesetround +#endif +#ifndef libc_fesetroundl +# define libc_fesetroundl default_libc_fesetround +#endif + static __always_inline void default_libc_feholdexcept_setround (fenv_t *e, int r) { diff --git a/libc/sysdeps/generic/paths.h b/libc/sysdeps/generic/paths.h index f85e88cb9..893b4c228 100644 --- a/libc/sysdeps/generic/paths.h +++ b/libc/sysdeps/generic/paths.h @@ -36,7 +36,7 @@ #define _PATH_DEFPATH "/usr/bin:/bin" /* All standard utilities path. */ #define _PATH_STDPATH \ - "/usr/bin:/bin:/usr/sbin:/sbin:/usr/contrib/bin:/usr/old/bin" + "/usr/bin:/bin:/usr/sbin:/sbin" #define _PATH_BSHELL "/bin/sh" #define _PATH_CONSOLE "/dev/console" @@ -50,8 +50,8 @@ #define _PATH_MAILDIR "/var/mail" #define _PATH_MAN "/usr/share/man" #define _PATH_MEM "/dev/mem" -#define _PATH_MNTTAB "/etc/fstab" -#define _PATH_MOUNTED "/var/run/mtab" +#define _PATH_MNTTAB "/etc/fstab" +#define _PATH_MOUNTED "/var/run/mtab" #define _PATH_NOLOGIN "/etc/nologin" #define _PATH_PRESERVE "/var/lib" #define _PATH_RWHODIR "/var/spool/rwho" diff --git a/libc/sysdeps/generic/tininess.h b/libc/sysdeps/generic/tininess.h new file mode 100644 index 000000000..fd0173995 --- /dev/null +++ b/libc/sysdeps/generic/tininess.h @@ -0,0 +1,33 @@ +/* Specify architecture-specific rules for determining tininess of + floating-point results. Generic version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _TININESS_H +#define _TININESS_H 1 + +/* Under IEEE 754, an architecture may determine tininess of + floating-point results either "before rounding" or "after + rounding", but must do so in the same way for all operations + returning binary results. Define TININESS_AFTER_ROUNDING to 1 for + "after rounding" architectures, 0 for "before rounding" + architectures. The test stdlib/tst-tininess will fail if the + definition is incorrect. */ + +#define TININESS_AFTER_ROUNDING 0 + +#endif /* tininess.h */ diff --git a/libc/sysdeps/i386/fpu/fclrexcpt.c b/libc/sysdeps/i386/fpu/fclrexcpt.c index f24d07f3d..f28ef6b3f 100644 --- a/libc/sysdeps/i386/fpu/fclrexcpt.c +++ b/libc/sysdeps/i386/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 1997,99,2000, 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -65,4 +65,5 @@ strong_alias (__feclearexcept, __old_feclearexcept) compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1); #endif +libm_hidden_ver (__feclearexcept, feclearexcept) versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2); diff --git a/libc/sysdeps/i386/fpu/fenv_private.h b/libc/sysdeps/i386/fpu/fenv_private.h index f33f57c39..03f4c97a9 100644 --- a/libc/sysdeps/i386/fpu/fenv_private.h +++ b/libc/sysdeps/i386/fpu/fenv_private.h @@ -76,6 +76,24 @@ libc_feholdexcept_387 (fenv_t *e) "st(4)", "st(5)", "st(6)", "st(7)"); } +static __always_inline void +libc_fesetround_sse (int r) +{ + unsigned int mxcsr; + asm (STMXCSR " %0" : "=m" (*&mxcsr)); + mxcsr = (mxcsr & ~0x6000) | (r << 3); + asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr)); +} + +static __always_inline void +libc_fesetround_387 (int r) +{ + fpu_control_t cw; + _FPU_GETCW (cw); + cw = (cw & ~0xc00) | r; + _FPU_SETCW (cw); +} + static __always_inline void libc_feholdexcept_setround_sse (fenv_t *e, int r) { @@ -247,6 +265,7 @@ libc_feresetround_387 (fenv_t *e) #ifdef __SSE_MATH__ # define libc_feholdexceptf libc_feholdexcept_sse +# define libc_fesetroundf libc_fesetround_sse # define libc_feholdexcept_setroundf libc_feholdexcept_setround_sse # define libc_fetestexceptf libc_fetestexcept_sse # define libc_fesetenvf libc_fesetenv_sse @@ -256,6 +275,7 @@ libc_feresetround_387 (fenv_t *e) # define libc_feresetroundf libc_feresetround_sse #else # define libc_feholdexceptf libc_feholdexcept_387 +# define libc_fesetroundf libc_fesetround_387 # define libc_feholdexcept_setroundf libc_feholdexcept_setround_387 # define libc_fetestexceptf libc_fetestexcept_387 # define libc_fesetenvf libc_fesetenv_387 @@ -267,6 +287,7 @@ libc_feresetround_387 (fenv_t *e) #ifdef __SSE2_MATH__ # define libc_feholdexcept libc_feholdexcept_sse +# define libc_fesetround libc_fesetround_sse # define libc_feholdexcept_setround libc_feholdexcept_setround_sse # define libc_fetestexcept libc_fetestexcept_sse # define libc_fesetenv libc_fesetenv_sse @@ -276,6 +297,7 @@ libc_feresetround_387 (fenv_t *e) # define libc_feresetround libc_feresetround_sse #else # define libc_feholdexcept libc_feholdexcept_387 +# define libc_fesetround libc_fesetround_387 # define libc_feholdexcept_setround libc_feholdexcept_setround_387 # define libc_fetestexcept libc_fetestexcept_387 # define libc_fesetenv libc_fesetenv_387 @@ -286,6 +308,7 @@ libc_feresetround_387 (fenv_t *e) #endif /* __SSE2_MATH__ */ #define libc_feholdexceptl libc_feholdexcept_387 +#define libc_fesetroundl libc_fesetround_387 #define libc_feholdexcept_setroundl libc_feholdexcept_setround_387 #define libc_fetestexceptl libc_fetestexcept_387 #define libc_fesetenvl libc_fesetenv_387 diff --git a/libc/sysdeps/ieee754/dbl-64/s_fma.c b/libc/sysdeps/ieee754/dbl-64/s_fma.c index 5e21461a4..8c69b987e 100644 --- a/libc/sysdeps/ieee754/dbl-64/s_fma.c +++ b/libc/sysdeps/ieee754/dbl-64/s_fma.c @@ -22,6 +22,7 @@ #include #include #include +#include /* This implementation uses rounding to odd to avoid problems with double rounding. See a paper by Boldo and Melquiond: @@ -54,17 +55,46 @@ __fma (double x, double y, double z) underflows to 0. */ if (z == 0 && x != 0 && y != 0) return x * y; - /* If x or y or z is Inf/NaN, or if fma will certainly overflow, - or if x * y is less than half of DBL_DENORM_MIN, - compute as x * y + z. */ + /* If x or y or z is Inf/NaN, or if x * y is zero, compute as + x * y + z. */ if (u.ieee.exponent == 0x7ff || v.ieee.exponent == 0x7ff || w.ieee.exponent == 0x7ff - || u.ieee.exponent + v.ieee.exponent - > 0x7ff + IEEE754_DOUBLE_BIAS - || u.ieee.exponent + v.ieee.exponent - < IEEE754_DOUBLE_BIAS - DBL_MANT_DIG - 2) + || x == 0 + || y == 0) return x * y + z; + /* If fma will certainly overflow, compute as x * y. */ + if (u.ieee.exponent + v.ieee.exponent > 0x7ff + IEEE754_DOUBLE_BIAS) + return x * y; + /* If x * y is less than 1/4 of DBL_DENORM_MIN, neither the + result nor whether there is underflow depends on its exact + value, only on its sign. */ + if (u.ieee.exponent + v.ieee.exponent + < IEEE754_DOUBLE_BIAS - DBL_MANT_DIG - 2) + { + int neg = u.ieee.negative ^ v.ieee.negative; + double tiny = neg ? -0x1p-1074 : 0x1p-1074; + if (w.ieee.exponent >= 3) + return tiny + z; + /* Scaling up, adding TINY and scaling down produces the + correct result, because in round-to-nearest mode adding + TINY has no effect and in other modes double rounding is + harmless. But it may not produce required underflow + exceptions. */ + v.d = z * 0x1p54 + tiny; + if (TININESS_AFTER_ROUNDING + ? v.ieee.exponent < 55 + : (w.ieee.exponent == 0 + || (w.ieee.exponent == 1 + && w.ieee.negative != neg + && w.ieee.mantissa1 == 0 + && w.ieee.mantissa0 == 0))) + { + volatile double force_underflow = x * y; + (void) force_underflow; + } + return v.d * 0x1p-54; + } if (u.ieee.exponent + v.ieee.exponent >= 0x7ff + IEEE754_DOUBLE_BIAS - DBL_MANT_DIG) { @@ -84,8 +114,17 @@ __fma (double x, double y, double z) { /* Similarly. If z exponent is very large and x and y exponents are - very small, it doesn't matter if we don't adjust it. */ - if (u.ieee.exponent > v.ieee.exponent) + very small, adjust them up to avoid spurious underflows, + rather than down. */ + if (u.ieee.exponent + v.ieee.exponent + <= IEEE754_DOUBLE_BIAS + DBL_MANT_DIG) + { + if (u.ieee.exponent > v.ieee.exponent) + u.ieee.exponent += 2 * DBL_MANT_DIG + 2; + else + v.ieee.exponent += 2 * DBL_MANT_DIG + 2; + } + else if (u.ieee.exponent > v.ieee.exponent) { if (u.ieee.exponent > DBL_MANT_DIG) u.ieee.exponent -= DBL_MANT_DIG; @@ -115,15 +154,15 @@ __fma (double x, double y, double z) <= IEEE754_DOUBLE_BIAS + DBL_MANT_DIG) */ { if (u.ieee.exponent > v.ieee.exponent) - u.ieee.exponent += 2 * DBL_MANT_DIG; + u.ieee.exponent += 2 * DBL_MANT_DIG + 2; else - v.ieee.exponent += 2 * DBL_MANT_DIG; - if (w.ieee.exponent <= 4 * DBL_MANT_DIG + 4) + v.ieee.exponent += 2 * DBL_MANT_DIG + 2; + if (w.ieee.exponent <= 4 * DBL_MANT_DIG + 6) { if (w.ieee.exponent) - w.ieee.exponent += 2 * DBL_MANT_DIG; + w.ieee.exponent += 2 * DBL_MANT_DIG + 2; else - w.d *= 0x1p106; + w.d *= 0x1p108; adjust = -1; } /* Otherwise x * y should just affect inexact @@ -138,6 +177,9 @@ __fma (double x, double y, double z) if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0)) return x * y + z; + fenv_t env; + libc_feholdexcept_setround (&env, FE_TONEAREST); + /* Multiplication m1 + m2 = x * y using Dekker's algorithm. */ #define C ((1 << (DBL_MANT_DIG + 1) / 2) + 1) double x1 = x * C; @@ -156,9 +198,20 @@ __fma (double x, double y, double z) t1 = m1 - t1; t2 = z - t2; double a2 = t1 + t2; + feclearexcept (FE_INEXACT); - fenv_t env; - libc_feholdexcept_setround (&env, FE_TOWARDZERO); + /* If the result is an exact zero, ensure it has the correct + sign. */ + if (a1 == 0 && m2 == 0) + { + libc_feupdateenv (&env); + /* Ensure that round-to-nearest value of z + m1 is not + reused. */ + asm volatile ("" : "=m" (z) : "m" (z)); + return z + m1; + } + + libc_fesetround (FE_TOWARDZERO); /* Perform m2 + a2 addition with round to odd. */ u.d = a2 + m2; @@ -194,39 +247,44 @@ __fma (double x, double y, double z) /* If a1 + u.d is exact, the only rounding happens during scaling down. */ if (j == 0) - return v.d * 0x1p-106; + return v.d * 0x1p-108; /* If result rounded to zero is not subnormal, no double rounding will occur. */ - if (v.ieee.exponent > 106) - return (a1 + u.d) * 0x1p-106; - /* If v.d * 0x1p-106 with round to zero is a subnormal above - or equal to DBL_MIN / 2, then v.d * 0x1p-106 shifts mantissa + if (v.ieee.exponent > 108) + return (a1 + u.d) * 0x1p-108; + /* If v.d * 0x1p-108 with round to zero is a subnormal above + or equal to DBL_MIN / 2, then v.d * 0x1p-108 shifts mantissa down just by 1 bit, which means v.ieee.mantissa1 |= j would change the round bit, not sticky or guard bit. - v.d * 0x1p-106 never normalizes by shifting up, + v.d * 0x1p-108 never normalizes by shifting up, so round bit plus sticky bit should be already enough for proper rounding. */ - if (v.ieee.exponent == 106) + if (v.ieee.exponent == 108) { - /* v.ieee.mantissa1 & 2 is LSB bit of the result before rounding, - v.ieee.mantissa1 & 1 is the round bit and j is our sticky - bit. In round-to-nearest 001 rounds down like 00, - 011 rounds up, even though 01 rounds down (thus we need - to adjust), 101 rounds down like 10 and 111 rounds up - like 11. */ - if ((v.ieee.mantissa1 & 3) == 1) + /* If the exponent would be in the normal range when + rounding to normal precision with unbounded exponent + range, the exact result is known and spurious underflows + must be avoided on systems detecting tininess after + rounding. */ + if (TININESS_AFTER_ROUNDING) { - v.d *= 0x1p-106; - if (v.ieee.negative) - return v.d - 0x1p-1074 /* __DBL_DENORM_MIN__ */; - else - return v.d + 0x1p-1074 /* __DBL_DENORM_MIN__ */; + w.d = a1 + u.d; + if (w.ieee.exponent == 109) + return w.d * 0x1p-108; } - else - return v.d * 0x1p-106; + /* v.ieee.mantissa1 & 2 is LSB bit of the result before rounding, + v.ieee.mantissa1 & 1 is the round bit and j is our sticky + bit. */ + w.d = 0.0; + w.ieee.mantissa1 = ((v.ieee.mantissa1 & 3) << 1) | j; + w.ieee.negative = v.ieee.negative; + v.ieee.mantissa1 &= ~3U; + v.d *= 0x1p-108; + w.d *= 0x1p-2; + return v.d + w.d; } v.ieee.mantissa1 |= j; - return v.d * 0x1p-106; + return v.d * 0x1p-108; } } #ifndef __fma diff --git a/libc/sysdeps/ieee754/ldbl-128/s_fmal.c b/libc/sysdeps/ieee754/ldbl-128/s_fmal.c index 46b3d81ce..c9accad8a 100644 --- a/libc/sysdeps/ieee754/ldbl-128/s_fmal.c +++ b/libc/sysdeps/ieee754/ldbl-128/s_fmal.c @@ -22,6 +22,7 @@ #include #include #include +#include /* This implementation uses rounding to odd to avoid problems with double rounding. See a paper by Boldo and Melquiond: @@ -55,17 +56,49 @@ __fmal (long double x, long double y, long double z) underflows to 0. */ if (z == 0 && x != 0 && y != 0) return x * y; - /* If x or y or z is Inf/NaN, or if fma will certainly overflow, - or if x * y is less than half of LDBL_DENORM_MIN, - compute as x * y + z. */ + /* If x or y or z is Inf/NaN, or if x * y is zero, compute as + x * y + z. */ if (u.ieee.exponent == 0x7fff || v.ieee.exponent == 0x7fff || w.ieee.exponent == 0x7fff - || u.ieee.exponent + v.ieee.exponent - > 0x7fff + IEEE854_LONG_DOUBLE_BIAS - || u.ieee.exponent + v.ieee.exponent - < IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2) + || x == 0 + || y == 0) return x * y + z; + /* If fma will certainly overflow, compute as x * y. */ + if (u.ieee.exponent + v.ieee.exponent + > 0x7fff + IEEE854_LONG_DOUBLE_BIAS) + return x * y; + /* If x * y is less than 1/4 of LDBL_DENORM_MIN, neither the + result nor whether there is underflow depends on its exact + value, only on its sign. */ + if (u.ieee.exponent + v.ieee.exponent + < IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2) + { + int neg = u.ieee.negative ^ v.ieee.negative; + long double tiny = neg ? -0x1p-16494L : 0x1p-16494L; + if (w.ieee.exponent >= 3) + return tiny + z; + /* Scaling up, adding TINY and scaling down produces the + correct result, because in round-to-nearest mode adding + TINY has no effect and in other modes double rounding is + harmless. But it may not produce required underflow + exceptions. */ + v.d = z * 0x1p114L + tiny; + if (TININESS_AFTER_ROUNDING + ? v.ieee.exponent < 115 + : (w.ieee.exponent == 0 + || (w.ieee.exponent == 1 + && w.ieee.negative != neg + && w.ieee.mantissa3 == 0 + && w.ieee.mantissa2 == 0 + && w.ieee.mantissa1 == 0 + && w.ieee.mantissa0 == 0))) + { + volatile long double force_underflow = x * y; + (void) force_underflow; + } + return v.d * 0x1p-114L; + } if (u.ieee.exponent + v.ieee.exponent >= 0x7fff + IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG) { @@ -85,8 +118,17 @@ __fmal (long double x, long double y, long double z) { /* Similarly. If z exponent is very large and x and y exponents are - very small, it doesn't matter if we don't adjust it. */ - if (u.ieee.exponent > v.ieee.exponent) + very small, adjust them up to avoid spurious underflows, + rather than down. */ + if (u.ieee.exponent + v.ieee.exponent + <= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) + { + if (u.ieee.exponent > v.ieee.exponent) + u.ieee.exponent += 2 * LDBL_MANT_DIG + 2; + else + v.ieee.exponent += 2 * LDBL_MANT_DIG + 2; + } + else if (u.ieee.exponent > v.ieee.exponent) { if (u.ieee.exponent > LDBL_MANT_DIG) u.ieee.exponent -= LDBL_MANT_DIG; @@ -116,15 +158,15 @@ __fmal (long double x, long double y, long double z) <= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) */ { if (u.ieee.exponent > v.ieee.exponent) - u.ieee.exponent += 2 * LDBL_MANT_DIG; + u.ieee.exponent += 2 * LDBL_MANT_DIG + 2; else - v.ieee.exponent += 2 * LDBL_MANT_DIG; - if (w.ieee.exponent <= 4 * LDBL_MANT_DIG + 4) + v.ieee.exponent += 2 * LDBL_MANT_DIG + 2; + if (w.ieee.exponent <= 4 * LDBL_MANT_DIG + 6) { if (w.ieee.exponent) - w.ieee.exponent += 2 * LDBL_MANT_DIG; + w.ieee.exponent += 2 * LDBL_MANT_DIG + 2; else - w.d *= 0x1p226L; + w.d *= 0x1p228L; adjust = -1; } /* Otherwise x * y should just affect inexact @@ -139,6 +181,10 @@ __fmal (long double x, long double y, long double z) if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0)) return x * y + z; + fenv_t env; + feholdexcept (&env); + fesetround (FE_TONEAREST); + /* Multiplication m1 + m2 = x * y using Dekker's algorithm. */ #define C ((1LL << (LDBL_MANT_DIG + 1) / 2) + 1) long double x1 = x * C; @@ -157,9 +203,19 @@ __fmal (long double x, long double y, long double z) t1 = m1 - t1; t2 = z - t2; long double a2 = t1 + t2; + feclearexcept (FE_INEXACT); + + /* If the result is an exact zero, ensure it has the correct + sign. */ + if (a1 == 0 && m2 == 0) + { + feupdateenv (&env); + /* Ensure that round-to-nearest value of z + m1 is not + reused. */ + asm volatile ("" : "=m" (z) : "m" (z)); + return z + m1; + } - fenv_t env; - feholdexcept (&env); fesetround (FE_TOWARDZERO); /* Perform m2 + a2 addition with round to odd. */ u.d = a2 + m2; @@ -195,39 +251,44 @@ __fmal (long double x, long double y, long double z) /* If a1 + u.d is exact, the only rounding happens during scaling down. */ if (j == 0) - return v.d * 0x1p-226L; + return v.d * 0x1p-228L; /* If result rounded to zero is not subnormal, no double rounding will occur. */ - if (v.ieee.exponent > 226) - return (a1 + u.d) * 0x1p-226L; - /* If v.d * 0x1p-226L with round to zero is a subnormal above - or equal to LDBL_MIN / 2, then v.d * 0x1p-226L shifts mantissa + if (v.ieee.exponent > 228) + return (a1 + u.d) * 0x1p-228L; + /* If v.d * 0x1p-228L with round to zero is a subnormal above + or equal to LDBL_MIN / 2, then v.d * 0x1p-228L shifts mantissa down just by 1 bit, which means v.ieee.mantissa3 |= j would change the round bit, not sticky or guard bit. - v.d * 0x1p-226L never normalizes by shifting up, + v.d * 0x1p-228L never normalizes by shifting up, so round bit plus sticky bit should be already enough for proper rounding. */ - if (v.ieee.exponent == 226) + if (v.ieee.exponent == 228) { - /* v.ieee.mantissa3 & 2 is LSB bit of the result before rounding, - v.ieee.mantissa3 & 1 is the round bit and j is our sticky - bit. In round-to-nearest 001 rounds down like 00, - 011 rounds up, even though 01 rounds down (thus we need - to adjust), 101 rounds down like 10 and 111 rounds up - like 11. */ - if ((v.ieee.mantissa3 & 3) == 1) + /* If the exponent would be in the normal range when + rounding to normal precision with unbounded exponent + range, the exact result is known and spurious underflows + must be avoided on systems detecting tininess after + rounding. */ + if (TININESS_AFTER_ROUNDING) { - v.d *= 0x1p-226L; - if (v.ieee.negative) - return v.d - 0x1p-16494L /* __LDBL_DENORM_MIN__ */; - else - return v.d + 0x1p-16494L /* __LDBL_DENORM_MIN__ */; + w.d = a1 + u.d; + if (w.ieee.exponent == 229) + return w.d * 0x1p-228L; } - else - return v.d * 0x1p-226L; + /* v.ieee.mantissa3 & 2 is LSB bit of the result before rounding, + v.ieee.mantissa3 & 1 is the round bit and j is our sticky + bit. */ + w.d = 0.0L; + w.ieee.mantissa3 = ((v.ieee.mantissa3 & 3) << 1) | j; + w.ieee.negative = v.ieee.negative; + v.ieee.mantissa3 &= ~3U; + v.d *= 0x1p-228L; + w.d *= 0x1p-2L; + return v.d + w.d; } v.ieee.mantissa3 |= j; - return v.d * 0x1p-226L; + return v.d * 0x1p-228L; } } weak_alias (__fmal, fmal) diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c index fe5c8bd8d..3e0535561 100644 --- a/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c +++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c @@ -65,7 +65,8 @@ __ieee754_atan2l(long double y, long double x) if(((ix)>0x7ff0000000000000LL)|| ((iy)>0x7ff0000000000000LL)) /* x or y is NaN */ return x+y; - if(((hx-0x3ff0000000000000LL))==0) return __atanl(y); /* x=1.0L */ + if(((hx-0x3ff0000000000000LL))==0 + && (lx&0x7fffffffffffffff)==0) return __atanl(y); /* x=1.0L */ m = ((hy>>63)&1)|((hx>>62)&2); /* 2*sign(x)+sign(y) */ /* when y = 0 */ diff --git a/libc/sysdeps/ieee754/ldbl-96/s_fma.c b/libc/sysdeps/ieee754/ldbl-96/s_fma.c index 001d8063d..bf2d794c9 100644 --- a/libc/sysdeps/ieee754/ldbl-96/s_fma.c +++ b/libc/sysdeps/ieee754/ldbl-96/s_fma.c @@ -42,6 +42,10 @@ __fma (double x, double y, double z) if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0)) return x * y + z; + fenv_t env; + feholdexcept (&env); + fesetround (FE_TONEAREST); + /* Multiplication m1 + m2 = x * y using Dekker's algorithm. */ #define C ((1ULL << (LDBL_MANT_DIG + 1) / 2) + 1) long double x1 = (long double) x * C; @@ -60,9 +64,19 @@ __fma (double x, double y, double z) t1 = m1 - t1; t2 = z - t2; long double a2 = t1 + t2; + feclearexcept (FE_INEXACT); + + /* If the result is an exact zero, ensure it has the correct + sign. */ + if (a1 == 0 && m2 == 0) + { + feupdateenv (&env); + /* Ensure that round-to-nearest value of z + m1 is not + reused. */ + asm volatile ("" : "=m" (z) : "m" (z)); + return z + m1; + } - fenv_t env; - feholdexcept (&env); fesetround (FE_TOWARDZERO); /* Perform m2 + a2 addition with round to odd. */ a2 = a2 + m2; diff --git a/libc/sysdeps/ieee754/ldbl-96/s_fmal.c b/libc/sysdeps/ieee754/ldbl-96/s_fmal.c index d12512428..c86dff6f8 100644 --- a/libc/sysdeps/ieee754/ldbl-96/s_fmal.c +++ b/libc/sysdeps/ieee754/ldbl-96/s_fmal.c @@ -22,6 +22,7 @@ #include #include #include +#include /* This implementation uses rounding to odd to avoid problems with double rounding. See a paper by Boldo and Melquiond: @@ -55,17 +56,47 @@ __fmal (long double x, long double y, long double z) underflows to 0. */ if (z == 0 && x != 0 && y != 0) return x * y; - /* If x or y or z is Inf/NaN, or if fma will certainly overflow, - or if x * y is less than half of LDBL_DENORM_MIN, - compute as x * y + z. */ + /* If x or y or z is Inf/NaN, or if x * y is zero, compute as + x * y + z. */ if (u.ieee.exponent == 0x7fff || v.ieee.exponent == 0x7fff || w.ieee.exponent == 0x7fff - || u.ieee.exponent + v.ieee.exponent - > 0x7fff + IEEE854_LONG_DOUBLE_BIAS - || u.ieee.exponent + v.ieee.exponent - < IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2) + || x == 0 + || y == 0) return x * y + z; + /* If fma will certainly overflow, compute as x * y. */ + if (u.ieee.exponent + v.ieee.exponent + > 0x7fff + IEEE854_LONG_DOUBLE_BIAS) + return x * y; + /* If x * y is less than 1/4 of LDBL_DENORM_MIN, neither the + result nor whether there is underflow depends on its exact + value, only on its sign. */ + if (u.ieee.exponent + v.ieee.exponent + < IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2) + { + int neg = u.ieee.negative ^ v.ieee.negative; + long double tiny = neg ? -0x1p-16445L : 0x1p-16445L; + if (w.ieee.exponent >= 3) + return tiny + z; + /* Scaling up, adding TINY and scaling down produces the + correct result, because in round-to-nearest mode adding + TINY has no effect and in other modes double rounding is + harmless. But it may not produce required underflow + exceptions. */ + v.d = z * 0x1p65L + tiny; + if (TININESS_AFTER_ROUNDING + ? v.ieee.exponent < 66 + : (w.ieee.exponent == 0 + || (w.ieee.exponent == 1 + && w.ieee.negative != neg + && w.ieee.mantissa1 == 0 + && w.ieee.mantissa0 == 0x80000000))) + { + volatile long double force_underflow = x * y; + (void) force_underflow; + } + return v.d * 0x1p-65L; + } if (u.ieee.exponent + v.ieee.exponent >= 0x7fff + IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG) { @@ -85,8 +116,17 @@ __fmal (long double x, long double y, long double z) { /* Similarly. If z exponent is very large and x and y exponents are - very small, it doesn't matter if we don't adjust it. */ - if (u.ieee.exponent > v.ieee.exponent) + very small, adjust them up to avoid spurious underflows, + rather than down. */ + if (u.ieee.exponent + v.ieee.exponent + <= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) + { + if (u.ieee.exponent > v.ieee.exponent) + u.ieee.exponent += 2 * LDBL_MANT_DIG + 2; + else + v.ieee.exponent += 2 * LDBL_MANT_DIG + 2; + } + else if (u.ieee.exponent > v.ieee.exponent) { if (u.ieee.exponent > LDBL_MANT_DIG) u.ieee.exponent -= LDBL_MANT_DIG; @@ -116,15 +156,15 @@ __fmal (long double x, long double y, long double z) <= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) */ { if (u.ieee.exponent > v.ieee.exponent) - u.ieee.exponent += 2 * LDBL_MANT_DIG; + u.ieee.exponent += 2 * LDBL_MANT_DIG + 2; else - v.ieee.exponent += 2 * LDBL_MANT_DIG; - if (w.ieee.exponent <= 4 * LDBL_MANT_DIG + 4) + v.ieee.exponent += 2 * LDBL_MANT_DIG + 2; + if (w.ieee.exponent <= 4 * LDBL_MANT_DIG + 6) { if (w.ieee.exponent) - w.ieee.exponent += 2 * LDBL_MANT_DIG; + w.ieee.exponent += 2 * LDBL_MANT_DIG + 2; else - w.d *= 0x1p128L; + w.d *= 0x1p130L; adjust = -1; } /* Otherwise x * y should just affect inexact @@ -139,6 +179,10 @@ __fmal (long double x, long double y, long double z) if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0)) return x * y + z; + fenv_t env; + feholdexcept (&env); + fesetround (FE_TONEAREST); + /* Multiplication m1 + m2 = x * y using Dekker's algorithm. */ #define C ((1LL << (LDBL_MANT_DIG + 1) / 2) + 1) long double x1 = x * C; @@ -157,9 +201,19 @@ __fmal (long double x, long double y, long double z) t1 = m1 - t1; t2 = z - t2; long double a2 = t1 + t2; + feclearexcept (FE_INEXACT); + + /* If the result is an exact zero, ensure it has the correct + sign. */ + if (a1 == 0 && m2 == 0) + { + feupdateenv (&env); + /* Ensure that round-to-nearest value of z + m1 is not + reused. */ + asm volatile ("" : "=m" (z) : "m" (z)); + return z + m1; + } - fenv_t env; - feholdexcept (&env); fesetround (FE_TOWARDZERO); /* Perform m2 + a2 addition with round to odd. */ u.d = a2 + m2; @@ -195,39 +249,44 @@ __fmal (long double x, long double y, long double z) /* If a1 + u.d is exact, the only rounding happens during scaling down. */ if (j == 0) - return v.d * 0x1p-128L; + return v.d * 0x1p-130L; /* If result rounded to zero is not subnormal, no double rounding will occur. */ - if (v.ieee.exponent > 128) - return (a1 + u.d) * 0x1p-128L; - /* If v.d * 0x1p-128L with round to zero is a subnormal above - or equal to LDBL_MIN / 2, then v.d * 0x1p-128L shifts mantissa + if (v.ieee.exponent > 130) + return (a1 + u.d) * 0x1p-130L; + /* If v.d * 0x1p-130L with round to zero is a subnormal above + or equal to LDBL_MIN / 2, then v.d * 0x1p-130L shifts mantissa down just by 1 bit, which means v.ieee.mantissa1 |= j would change the round bit, not sticky or guard bit. - v.d * 0x1p-128L never normalizes by shifting up, + v.d * 0x1p-130L never normalizes by shifting up, so round bit plus sticky bit should be already enough for proper rounding. */ - if (v.ieee.exponent == 128) + if (v.ieee.exponent == 130) { - /* v.ieee.mantissa1 & 2 is LSB bit of the result before rounding, - v.ieee.mantissa1 & 1 is the round bit and j is our sticky - bit. In round-to-nearest 001 rounds down like 00, - 011 rounds up, even though 01 rounds down (thus we need - to adjust), 101 rounds down like 10 and 111 rounds up - like 11. */ - if ((v.ieee.mantissa1 & 3) == 1) + /* If the exponent would be in the normal range when + rounding to normal precision with unbounded exponent + range, the exact result is known and spurious underflows + must be avoided on systems detecting tininess after + rounding. */ + if (TININESS_AFTER_ROUNDING) { - v.d *= 0x1p-128L; - if (v.ieee.negative) - return v.d - 0x1p-16445L /* __LDBL_DENORM_MIN__ */; - else - return v.d + 0x1p-16445L /* __LDBL_DENORM_MIN__ */; + w.d = a1 + u.d; + if (w.ieee.exponent == 131) + return w.d * 0x1p-130L; } - else - return v.d * 0x1p-128L; + /* v.ieee.mantissa1 & 2 is LSB bit of the result before rounding, + v.ieee.mantissa1 & 1 is the round bit and j is our sticky + bit. */ + w.d = 0.0L; + w.ieee.mantissa1 = ((v.ieee.mantissa1 & 3) << 1) | j; + w.ieee.negative = v.ieee.negative; + v.ieee.mantissa1 &= ~3U; + v.d *= 0x1p-130L; + w.d *= 0x1p-2L; + return v.d + w.d; } v.ieee.mantissa1 |= j; - return v.d * 0x1p-128L; + return v.d * 0x1p-130L; } } weak_alias (__fmal, fmal) diff --git a/libc/sysdeps/mach/hurd/Makefile b/libc/sysdeps/mach/hurd/Makefile index 107eaafb0..ed77903a4 100644 --- a/libc/sysdeps/mach/hurd/Makefile +++ b/libc/sysdeps/mach/hurd/Makefile @@ -167,11 +167,15 @@ $(objpfx)librtld.map: $(rpcuserlibs:.so=_pic.a) CFLAGS-dl-load.c = -DEXTERNAL_MAP_FROM_FD endif -# We need these libs to link static programs in the libc source tree, too. -link-libc-static := -Wl,-\( \ +# Override the generic Makeconfig values so we link against the RPC libs. +link-libc-static := -Wl,--start-group \ $(patsubst %,$(common-objpfx)%.a,\ libc mach/libmachuser hurd/libhurduser) \ - $(static-gnulib) -Wl,-\) + $(static-gnulib) -Wl,--end-group +link-libc-static-tests := -Wl,--start-group \ + $(patsubst %,$(common-objpfx)%.a,\ + libc mach/libmachuser hurd/libhurduser) \ + $(static-gnulib-tests) -Wl,--end-group ifeq ($(subdir),csu) diff --git a/libc/sysdeps/mach/hurd/bits/errno.h b/libc/sysdeps/mach/hurd/bits/errno.h index a7d57adeb..3b6fe76b3 100644 --- a/libc/sysdeps/mach/hurd/bits/errno.h +++ b/libc/sysdeps/mach/hurd/bits/errno.h @@ -212,8 +212,8 @@ enum __error_t_codes #define EPROTO _HURD_ERRNO (116)/* Protocol error */ ETIME = _HURD_ERRNO (117), #define ETIME _HURD_ERRNO (117)/* Timer expired */ - ECANCELED = _HURD_ERRNO (118), -#define ECANCELED _HURD_ERRNO (118)/* Operation canceled */ + ECANCELED = _HURD_ERRNO (119), +#define ECANCELED _HURD_ERRNO (119)/* Operation canceled */ /* Errors from . */ EMACH_SEND_IN_PROGRESS = 0x10000001, @@ -297,7 +297,7 @@ enum __error_t_codes }; -#define _HURD_ERRNOS 119 +#define _HURD_ERRNOS 120 /* User-visible type of error codes. It is ok to use `int' or `kern_return_t' for these, but with `error_t' the debugger prints diff --git a/libc/sysdeps/mach/hurd/bits/param.h b/libc/sysdeps/mach/hurd/bits/param.h index d52c1edcb..2f53f686d 100644 --- a/libc/sysdeps/mach/hurd/bits/param.h +++ b/libc/sysdeps/mach/hurd/bits/param.h @@ -83,5 +83,3 @@ #define FSHIFT 11 /* Bits to right of fixed binary point. */ #define FSCALE (1<. */ - -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H -# error "Never use directly; include instead." -#endif - -#ifndef sc_pc - -/* Signal handlers are actually called: - void handler (int sig, int code, struct sigcontext *scp); */ - -/* State of this thread when the signal was taken. */ -struct sigcontext - { - /* These first members are machine-independent. */ - - int sc_onstack; /* Nonzero if running on sigstack. */ - __sigset_t sc_mask; /* Blocked signals to restore. */ - - /* MiG reply port this thread is using. */ - unsigned int sc_reply_port; - - /* Port this thread is doing an interruptible RPC on. */ - unsigned int sc_intr_port; - - /* Error code associated with this signal (interpreted as `error_t'). */ - int sc_error; - - /* All following members are machine-dependent. The rest of this - structure is written to be laid out identically to: - { - struct ppc_thread_state basic; - struct ppc_exc_state exc; - struct ppc_float_state fpu; - } - trampoline.c knows this, so it must be changed if this changes. */ - -#define sc_ppc_thread_state sc_srr0 /* Beginning of correspondence. */ -#define sc_pc sc_srr0 /* For sysdeps/generic/profil-counter.h. */ - unsigned int sc_srr0; - unsigned int sc_srr1; - unsigned int sc_gprs[32]; - unsigned int sc_cr; - unsigned int sc_xer; - unsigned int sc_lr; - unsigned int sc_ctr; - unsigned int sc_mq; - unsigned int sc_ts_pad; - -#define sc_ppc_exc_state sc_dar - unsigned int sc_dar; - unsigned int sc_dsisr; - unsigned int sc_exception; - unsigned int sc_es_pad0; - unsigned int sc_es_pad1[4]; - -#define sc_ppc_float_state sc_fprs[0] - double sc_fprs[32]; - unsigned int sc_fpscr_pad; - unsigned int sc_fpscr; - }; - -#endif /* sc_pc */ diff --git a/libc/sysdeps/mach/hurd/powerpc/exc2signal.c b/libc/sysdeps/mach/hurd/powerpc/exc2signal.c deleted file mode 100644 index 05df67038..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/exc2signal.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Translate Mach exception codes into signal numbers. PowerPC version. - Copyright (C) 1991,92,94,96,97,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include - -/* Translate the Mach exception codes, as received in an `exception_raise' RPC, - into a signal number and signal subcode. */ - -void -_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo) -{ - detail->error = 0; - - switch (detail->exc) - { - default: - *signo = SIGIOT; - detail->code = detail->exc; - break; - - case EXC_BAD_ACCESS: - if (detail->exc_code == KERN_PROTECTION_FAILURE) - *signo = SIGSEGV; - else - *signo = SIGBUS; - detail->code = detail->exc_subcode; - detail->error = detail->exc_code; - break; - - /* XXX there has got to be something more here */ - - case EXC_BAD_INSTRUCTION: - *signo = SIGILL; - detail->code = 0; - break; - - case EXC_ARITHMETIC: - *signo = SIGFPE; - detail->code = 0; - break; - - case EXC_EMULATION: - *signo = SIGEMT; - detail->code = 0; - break; - - case EXC_SOFTWARE: - *signo = SIGEMT; - detail->code = 0; - break; - - case EXC_BREAKPOINT: - *signo = SIGTRAP; - detail->code = 0; - } -} diff --git a/libc/sysdeps/mach/hurd/powerpc/init-first.c b/libc/sysdeps/mach/hurd/powerpc/init-first.c deleted file mode 100644 index 9531b5a6e..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/init-first.c +++ /dev/null @@ -1,342 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. PowerPC/Hurd. - Copyright (C) 1995-2012 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "hurdstartup.h" -#include "hurdmalloc.h" /* XXX */ - -extern void __mach_init (void); -extern void __init_misc (int, char **, char **); -#ifdef USE_NONOPTION_FLAGS -extern void __getopt_clean_environment (char **); -#endif -#ifndef SHARED -extern void _dl_non_dynamic_init (void) internal_function; -#endif -extern void __libc_global_ctors (void); - -unsigned int __hurd_threadvar_max; -unsigned long int __hurd_threadvar_stack_offset; -unsigned long int __hurd_threadvar_stack_mask; - -#ifndef SHARED -int __libc_enable_secure; -#endif -int __libc_multiple_libcs attribute_hidden = 1; - -extern int __libc_argc attribute_hidden; -extern char **__libc_argv attribute_hidden; -extern char **_dl_argv; - -void *(*_cthread_init_routine) (void); /* Returns new SP to use. */ -void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__)); - -#ifndef SHARED -static unsigned int return_address; /* Make init1 return to _start. */ -#endif - -/* Things that want to be run before _hurd_init or much anything else. - Importantly, these are called before anything tries to use malloc. */ -DEFINE_HOOK (_hurd_preinit_hook, (void)); - - -/* We call this once the Hurd magic is all set up and we are ready to be a - Posixoid program. This does the same things the generic version does. */ -static void internal_function -posixland_init (int argc, char **argv, char **envp) -{ - asm ("li 3,0xbb; .long 0"); - __libc_argc = argc; - __libc_argv = argv; - __environ = envp; - -#ifndef SHARED - _dl_non_dynamic_init (); -#endif - __init_misc (argc, argv, envp); - -#ifdef USE_NONOPTION_FLAGS - /* This is a hack to make the special getopt in GNU libc working. */ - __getopt_clean_environment (__environ); -#endif - - /* Initialize ctype data. */ - __ctype_init (); - -#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS - __libc_global_ctors (); -#endif -} - - -static void -init1 (int *data) -{ - int argc = *data; - char **argv = (char **) &data[1]; - char **envp = &argv[argc + 1]; - struct hurd_startup_data *d; - - while (*envp) - ++envp; - d = (void *) ++envp; - - /* If we are the bootstrap task started by the kernel, - then after the environment pointers there is no Hurd - data block; the argument strings start there. */ - /* OSF Mach starts the bootstrap task with argc == 0. - XXX This fails if a non-bootstrap task gets started - with argc == 0. */ - if (argc && (void *) d != argv[0]) - { - _hurd_init_dtable = d->dtable; - _hurd_init_dtablesize = d->dtablesize; - -#if 0 /* We can't free the old stack because it contains the argument strings. */ - { - /* Check if the stack we are now on is different from - the one described by _hurd_stack_{base,size}. */ - - char dummy; - const vm_address_t newsp = (vm_address_t) &dummy; - - if (d->stack_size != 0 && (newsp < d->stack_base || - newsp - d->stack_base > d->stack_size)) - /* The new stack pointer does not intersect with the - stack the exec server set up for us, so free that stack. */ - __vm_deallocate (__mach_task_self (), d->stack_base, d->stack_size); - } -#endif - } - - if (argc && (void *) d != argv[0] && (d->portarray || d->intarray)) - /* Initialize library data structures, start signal processing, etc. */ - _hurd_init (d->flags, argv, - d->portarray, d->portarraysize, - d->intarray, d->intarraysize); - -#ifndef SHARED - __libc_enable_secure = d->flags & EXEC_SECURE; -#endif -} - - -static inline void -init (int *data) -{ - int argc = *data; - char **argv = (void *) (data + 1); - char **envp = &argv[argc + 1]; - struct hurd_startup_data *d; - unsigned long int threadvars[_HURD_THREADVAR_MAX]; - - /* Provide temporary storage for thread-specific variables on the startup - stack so the cthreads initialization code can use them for malloc et al, - or so we can use malloc below for the real threadvars array. */ - memset (threadvars, 0, sizeof threadvars); - __hurd_threadvar_stack_offset = (unsigned long int) threadvars; - - while (*envp) - ++envp; - d = (void *) ++envp; - - /* The user might have defined a value for this, to get more variables. - Otherwise it will be zero on startup. We must make sure it is set - properly before before cthreads initialization, so cthreads can know - how much space to leave for thread variables. */ - if (__hurd_threadvar_max < _HURD_THREADVAR_MAX) - __hurd_threadvar_max = _HURD_THREADVAR_MAX; - - - /* After possibly switching stacks, call `init1' (above) with the user - code as the return address, and the argument data immediately above - that on the stack. */ - - if (_cthread_init_routine) - { - /* Initialize cthreads, which will allocate us a new stack to run on. */ - void *newsp = (*_cthread_init_routine) (); - struct hurd_startup_data *od; -#ifdef SHARED - void *oldsp; - unsigned int i, data_offset; -#endif - - /* Copy per-thread variables from that temporary - area onto the new cthread stack. */ - memcpy (__hurd_threadvar_location_from_sp (0, newsp), - threadvars, sizeof threadvars); - - /* Copy the argdata from the old stack to the new one. */ - newsp = memcpy (newsp - ((char *) &d[1] - (char *) data), data, - (char *) d - (char *) data); - -#ifdef SHARED - /* And readjust the dynamic linker's idea of where the argument - vector lives. */ - assert (_dl_argv == argv); - _dl_argv = (void *) ((int *) newsp + 1); -#endif - - /* Set up the Hurd startup data block immediately following - the argument and environment pointers on the new stack. */ - od = (newsp + ((char *) d - (char *) data)); - if (!argc || (void *) argv[0] == d) - /* We were started up by the kernel with arguments on the stack. - There is no Hurd startup data, so zero the block. */ - memset (od, 0, sizeof *od); - else - /* Copy the Hurd startup data block to the new stack. */ - *od = *d; - -#ifndef SHARED - asm ("mtlr %0; mr 1,%1; li 0,0; mr 3,%1; stwu 0,-16(1); b init1" - : : "r" (return_address), "r" (newsp)); - (void) init1; /* To avoid `defined but not used' warning. */ - /* NOTREACHED */ -#else - /* Copy the rest of the stack. Don't call a function to do that, - because that will alter the current stack. */ - asm ("mr %0,1" : "=r" (oldsp)); - data_offset = (unsigned int) data - (unsigned int) oldsp; - newsp -= data_offset; - for (i = 0; i < data_offset / 4; i++) - ((unsigned int *)newsp)[i] = ((unsigned int *)oldsp)[i]; - - /* Relocate stack frames. */ - { - unsigned int *oldframe0 = (unsigned int *)oldsp; - unsigned int *oldframe1 = *(unsigned int **)oldframe0; - unsigned int *oldframe2 = *(unsigned int **)oldframe1; - unsigned int *newframe0 = (unsigned int *)newsp; - unsigned int *newframe1 = newframe0 + (unsigned int)(oldframe1 - oldframe0); - unsigned int *newframe2 = newframe1 + (unsigned int)(oldframe2 - oldframe1); - *(unsigned int **)newframe0 = newframe1; - *(unsigned int **)newframe1 = newframe2; - } - - asm ("mr 1,%0; mr 31,%0" : : "r" (newsp)); /* XXX */ - init1 (newsp + data_offset); -#endif - } - else - { - /* We are not using cthreads, so we will have just a single allocated - area for the per-thread variables of the main user thread. */ - unsigned long int *array; - unsigned int i; - - array = malloc (__hurd_threadvar_max * sizeof (unsigned long int)); - if (array == NULL) - __libc_fatal ("Can't allocate single-threaded thread variables."); - - /* Copy per-thread variables from the temporary array into the - newly malloc'd space. */ - memcpy (array, threadvars, sizeof threadvars); - __hurd_threadvar_stack_offset = (unsigned long int) array; - for (i = _HURD_THREADVAR_MAX; i < __hurd_threadvar_max; ++i) - array[i] = 0; - -#ifndef SHARED - asm ("mr 3,%0; mtlr %1; addi 1,3,-16; b init1" - : : "r" (data), "r" (return_address)); - /* NOTREACHED */ -#else - init1 (data); -#endif - } -} - - -/* Do the first essential initializations that must precede all else. */ -static inline void -first_init (void) -{ - /* Initialize data structures so we can do RPCs. */ - __mach_init (); - - RUN_HOOK (_hurd_preinit_hook, ()); -} - -#ifdef SHARED -/* This function is called specially by the dynamic linker to do early - initialization of the shared C library before normal initializers - expecting a Posixoid environment can run. It gets called with the - stack set up just as the user will see it, so it can switch stacks. */ - -void -_dl_init_first (int argc, ...) -{ - asm ("li 3,0xaa; .long 0"); - first_init (); - - init (&argc); -} -#endif - - -#ifdef SHARED -/* The regular posixland initialization is what goes into libc's - normal initializer. */ -/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT - pointer in the dynamic section based solely on that. It is convention - for this function to be in the `.init' section, but the symbol name is - the only thing that really matters!! */ -strong_alias (posixland_init, _init); - - -void -__libc_init_first (int argc, char **argv, char **envp) -{ - /* Everything was done in the shared library initializer, _init. */ -} -#else -strong_alias (posixland_init, __libc_init_first); - - -void -_hurd_stack_setup (int *data) -{ - register unsigned int address; - asm ("mflr %0" : "=r" (address)); - return_address = address; - - first_init (); - - _hurd_startup ((void **) data, &init); -} -#endif - - -/* This function is defined here so that if this file ever gets into - ld.so we will get a link error. Having this file silently included - in ld.so causes disaster, because the _init definition above will - cause ld.so to gain an init function, which is not a cool thing. */ - -void -_dl_start (void) -{ - abort (); -} diff --git a/libc/sysdeps/mach/hurd/powerpc/intr-msg.h b/libc/sysdeps/mach/hurd/powerpc/intr-msg.h deleted file mode 100644 index c567217c9..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/intr-msg.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Machine-dependent details of interruptible RPC messaging. PowerPC version. - Copyright (C) 1995,96,97,99,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \ -({ \ - error_t err; \ - asm (".globl _hurd_intr_rpc_msg_do_trap\n" \ - ".globl _hurd_intr_rpc_msg_in_trap\n" \ - " mr 3, %1\n" \ - " mr 4, %2\n" \ - " mr 5, %3\n" \ - " mr 6, %4\n" \ - " mr 7, %5\n" \ - " mr 8, %6\n" \ - " mr 9, %7\n" \ - " li 0, -25\n" \ - "_hurd_intr_rpc_msg_do_trap: sc\n" \ - "_hurd_intr_rpc_msg_in_trap: mr 3, %0\n" \ - : "=r" (err) \ - : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \ - "r" (rcv_name), "r" (timeout), "r" (notify) \ - : "0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); \ - err; \ -}) - -static void inline -INTR_MSG_BACK_OUT (struct ppc_thread_state *state) -{ - return; -} - -#include "hurdfault.h" - -/* This cannot be an inline function because it calls setjmp. */ -#define SYSCALL_EXAMINE(state, callno) \ -({ \ - u_int32_t *p = (void *) ((state)->srr0 - 4); \ - int result; \ - _hurdsig_catch_memory_fault (p) ? 0 : \ - ({ \ - if (result = (*p == 0x44000002)) \ - /* The PC is just after an `sc' instruction. \ - This is a system call in progress; %r0 holds the call number. */ \ - *(callno) = (state)->r0; \ - _hurdsig_end_catch_fault (); \ - result; \ - }); \ -}) - -struct mach_msg_trap_args - { - /* This is the order of arguments to mach_msg_trap. */ - mach_msg_header_t *msg; - mach_msg_option_t option; - mach_msg_size_t send_size; - mach_msg_size_t rcv_size; - mach_port_t rcv_name; - mach_msg_timeout_t timeout; - mach_port_t notify; - }; - -/* This cannot be an inline function because it calls setjmp. */ -#define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout) \ -({ \ - mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r3; \ - *(option) = (mach_msg_option_t) (state)->r4; \ - *(rcv_name) = (mach_port_t) (state)->r7; \ - *(timeout) = (mach_msg_timeout_t) (state)->r8; \ - (msg == 0) ? \ - ({ \ - *(send_name) = MACH_PORT_NULL; \ - *(msgid) = 0; \ - 0; \ - }) : \ - (_hurdsig_catch_memory_fault (msg) ? -1 : \ - ({ \ - *(send_name) = msg->msgh_remote_port; \ - *(msgid) = msg->msgh_id; \ - _hurdsig_end_catch_fault (); \ - 0; \ - }) \ - ); \ -}) diff --git a/libc/sysdeps/mach/hurd/powerpc/longjmp-ts.c b/libc/sysdeps/mach/hurd/powerpc/longjmp-ts.c deleted file mode 100644 index 88f2f6a14..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/longjmp-ts.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Perform a `longjmp' on a Mach thread_state. PowerPC version. - Copyright (C) 1991,94,95,97,2001, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - - -/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */ - -void -_hurd_longjmp_thread_state (void *state, jmp_buf env, int val) -{ - struct ppc_thread_state *ts = state; - - /* XXX should we set up the FPRs as well? And how? */ - ts->r1 = env[0].__jmpbuf[JB_GPR1]; - ts->r2 = env[0].__jmpbuf[JB_GPR2]; - ts->r14 = env[0].__jmpbuf[JB_GPRS+0]; - ts->r15 = env[0].__jmpbuf[JB_GPRS+1]; - ts->r16 = env[0].__jmpbuf[JB_GPRS+2]; - ts->r17 = env[0].__jmpbuf[JB_GPRS+3]; - ts->r18 = env[0].__jmpbuf[JB_GPRS+4]; - ts->r19 = env[0].__jmpbuf[JB_GPRS+5]; - ts->r20 = env[0].__jmpbuf[JB_GPRS+6]; - ts->r21 = env[0].__jmpbuf[JB_GPRS+7]; - ts->r22 = env[0].__jmpbuf[JB_GPRS+8]; - ts->r23 = env[0].__jmpbuf[JB_GPRS+9]; - ts->r24 = env[0].__jmpbuf[JB_GPRS+10]; - ts->r25 = env[0].__jmpbuf[JB_GPRS+11]; - ts->r26 = env[0].__jmpbuf[JB_GPRS+12]; - ts->r27 = env[0].__jmpbuf[JB_GPRS+13]; - ts->r28 = env[0].__jmpbuf[JB_GPRS+14]; - ts->r29 = env[0].__jmpbuf[JB_GPRS+15]; - ts->r30 = env[0].__jmpbuf[JB_GPRS+16]; - ts->r31 = env[0].__jmpbuf[JB_GPRS+17]; - ts->cr = env[0].__jmpbuf[JB_CR]; - ts->r3 = val ?: 1; - ts->srr0 = ts->lr = env[0].__jmpbuf[JB_LR]; -} diff --git a/libc/sysdeps/mach/hurd/powerpc/register-dump.h b/libc/sysdeps/mach/hurd/powerpc/register-dump.h deleted file mode 100644 index 80d545e48..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/register-dump.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Dump registers. PowerPC/Hurd version. - Copyright (C) 1998, 2001, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include <_itoa.h> - -/* This prints out the information in the following form: */ -static const char dumpform[] = "\ -Register dump:\n\ -fp0-3: 0000030%0000031% 0000032%0000033% 0000034%0000035% 0000036%0000037%\n\ -fp4-7: 0000038%0000039% 000003a%000003b% 000003c%000003d% 000003e%000003f%\n\ -fp8-11: 0000040%0000041% 0000042%0000043% 0000044%0000045% 0000046%0000047%\n\ -fp12-15: 0000048%0000049% 000004a%000004b% 000004c%000004d% 000004e%000004f%\n\ -fp16-19: 0000050%0000051% 0000052%0000053% 0000054%0000055% 0000056%0000057%\n\ -fp20-23: 0000058%0000059% 000005a%000005b% 000005c%000005d% 000005e%000005f%\n\ -fp24-27: 0000060%0000061% 0000062%0000063% 0000064%0000065% 0000066%0000067%\n\ -fp28-31: 0000068%0000069% 000006a%000006b% 000006c%000006d% 000006e%000006f%\n\ -r0 =0000002% sp =0000003% r2 =0000004% r3 =0000005%\n\ -r4 =0000006% r5 =0000007% r6 =0000008% r7 =0000009% sr0=0000000% sr1=0000001%\n\ -r8 =000000a% r9 =000000b% r10=000000c% r11=000000d% cr=0000022% xer=0000023%\n\ -r12=000000e% r13=000000f% r14=0000010% r15=0000011% lr=0000024% ctr=0000025%\n\ -r16=0000012% r17=0000013% r18=0000014% r19=0000015% mq=0000026% fcr=0000071%\n\ -r20=0000016% r21=0000017% r22=0000018% r23=0000019% dar=0000028% dsi=0000029%\n\ -r24=000001a% r25=000001b% r26=000001c% r27=000001d% exc=000002a%\n\ -r28=000001e% r29=000001f% r30=0000020% r31=0000021%\n\ -"; - -/* Most of the fields are self-explanatory. 'sr0' is the next - instruction to execute, from SRR0, which may have some relationship - with the instruction that caused the exception. 'r3*' is the value - that will be returned in register 3 when the current system call - returns. 'sr1' is SRR1, bits 16-31 of which are copied from the MSR: - - 16 - External interrupt enable - 17 - Privilege level (1=user, 0=supervisor) - 18 - FP available - 19 - Machine check enable (if clear, processor locks up on machine check) - 20 - FP exception mode bit 0 (FP exceptions recoverable) - 21 - Single-step trace enable - 22 - Branch trace enable - 23 - FP exception mode bit 1 - 25 - exception prefix (if set, exceptions are taken from 0xFFFnnnnn, - otherwise from 0x000nnnnn). - 26 - Instruction address translation enabled. - 27 - Data address translation enabled. - 30 - Exception is recoverable (otherwise, don't try to return). - 31 - Little-endian mode enable. - - 'Trap' is the address of the exception: - - 00200 - Machine check exception (memory parity error, for instance) - 00300 - Data access exception (memory not mapped, see dsisr for why) - 00400 - Instruction access exception (memory not mapped) - 00500 - External interrupt - 00600 - Alignment exception (see dsisr for more information) - 00700 - Program exception (illegal/trap instruction, FP exception) - 00800 - FP unavailable (should not be seen by user code) - 00900 - Decrementer exception (for instance, SIGALRM) - 00A00 - I/O controller interface exception - 00C00 - System call exception (for instance, kill(3)). - 00E00 - FP assist exception (optional FP instructions, etc.) - - 'dar' is the memory location, for traps 00300, 00400, 00600, 00A00. - 'dsisr' has the following bits under trap 00300: - 0 - direct-store error exception - 1 - no page table entry for page - 4 - memory access not permitted - 5 - trying to access I/O controller space or using lwarx/stwcx on - non-write-cached memory - 6 - access was store - 9 - data access breakpoint hit - 10 - segment table search failed to find translation (64-bit ppcs only) - 11 - I/O controller instruction not permitted - For trap 00400, the same bits are set in SRR1 instead. - For trap 00600, bits 12-31 of the DSISR set to allow emulation of - the instruction without actually having to read it from memory. -*/ - -#define xtoi(x) (x >= 'a' ? x + 10 - 'a' : x - '0') - -static void -register_dump (int fd, struct sigcontext *ctx) -{ - char buffer[sizeof(dumpform)]; - char *bufferpos; - unsigned regno; - unsigned *regs = (unsigned *)(&ctx->sc_srr0); - - memcpy(buffer, dumpform, sizeof(dumpform)); - - /* Generate the output. */ - while ((bufferpos = memchr (buffer, '%', sizeof(dumpform)))) - { - regno = xtoi (bufferpos[-1]) | xtoi (bufferpos[-2]) << 4; - memset (bufferpos-2, '0', 3); - _itoa_word (regs[regno], bufferpos+1, 16, 0); - } - - /* Write the output. */ - write (fd, buffer, sizeof(buffer) - 1); -} - -#define REGISTER_DUMP \ - register_dump (fd, ctx) diff --git a/libc/sysdeps/mach/hurd/powerpc/sigreturn.c b/libc/sysdeps/mach/hurd/powerpc/sigreturn.c deleted file mode 100644 index 18107090b..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/sigreturn.c +++ /dev/null @@ -1,185 +0,0 @@ -/* Return from signal handler for Hurd. PowerPC version. - Copyright (C) 1996,97,98,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - -int -__sigreturn (struct sigcontext *scp) -{ - struct hurd_sigstate *ss; - mach_port_t *reply_port; - - if (scp == NULL || (scp->sc_mask & _SIG_CANT_MASK)) - { - errno = EINVAL; - return -1; - } - - ss = _hurd_self_sigstate (); - __spin_lock (&ss->lock); - - /* Restore the set of blocked signals, and the intr_port slot. */ - ss->blocked = scp->sc_mask; - ss->intr_port = scp->sc_intr_port; - - /* Check for pending signals that were blocked by the old set. */ - if (ss->pending & ~ss->blocked) - { - /* There are pending signals that just became unblocked. Wake up the - signal thread to deliver them. But first, squirrel away SCP where - the signal thread will notice it if it runs another handler, and - arrange to have us called over again in the new reality. */ - ss->context = scp; - __spin_unlock (&ss->lock); - __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ()); - /* If a pending signal was handled, sig_post never returned. */ - __spin_lock (&ss->lock); - ss->context = NULL; - } - - if (scp->sc_onstack) - { - ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */ - /* XXX cannot unlock until off sigstack */ - abort (); - } - else - __spin_unlock (&ss->lock); - - /* Destroy the MiG reply port used by the signal handler, and restore the - reply port in use by the thread when interrupted. */ - reply_port = - (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY); - if (*reply_port) - { - mach_port_t port = *reply_port; - - /* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port not to - get another reply port, but avoids mig_dealloc_reply_port trying to - deallocate it after the receive fails (which it will, because the - reply port will be bogus, whether we do this or not). */ - *reply_port = MACH_PORT_DEAD; - - __mach_port_destroy (__mach_task_self (), port); - } - *reply_port = scp->sc_reply_port; - - /* Restore FPU state. */ -#define restore_fpr(n) \ - asm volatile ("lfd " #n ",%0(31)" : : "i" (n * 4)) - - asm volatile ("mr 31,%0" : : "r" (scp->sc_fprs)); - - /* Restore the floating-point control/status register. */ - asm volatile ("lfd 0,256(31)"); - asm volatile ("mtfsf 0xff,0"); - - /* Restore floating-point registers. */ - restore_fpr (0); - restore_fpr (1); - restore_fpr (2); - restore_fpr (3); - restore_fpr (4); - restore_fpr (5); - restore_fpr (6); - restore_fpr (7); - restore_fpr (8); - restore_fpr (9); - restore_fpr (10); - restore_fpr (11); - restore_fpr (12); - restore_fpr (13); - restore_fpr (14); - restore_fpr (15); - restore_fpr (16); - restore_fpr (17); - restore_fpr (18); - restore_fpr (19); - restore_fpr (20); - restore_fpr (21); - restore_fpr (22); - restore_fpr (23); - restore_fpr (24); - restore_fpr (25); - restore_fpr (26); - restore_fpr (27); - restore_fpr (28); - restore_fpr (29); - restore_fpr (30); - restore_fpr (31); - - /* Load all the registers from the sigcontext. */ -#define restore_gpr(n) \ - asm volatile ("lwz " #n ",%0(31)" : : "i" (n * 4)) - - asm volatile ("addi 31,31,-188"); /* r31 = scp->gprs */ - - /* Restore the special purpose registers. */ - asm volatile ("lwz 0,128(31); mtcr 0"); - asm volatile ("lwz 0,132(31); mtxer 0"); - asm volatile ("lwz 0,136(31); mtlr 0"); - asm volatile ("lwz 0,-8(31); mtctr 0"); /* XXX this is the PC */ -#if 0 - asm volatile ("lwz 0,144(31); mtmq %0"); /* PPC601 only */ -#endif - - /* Restore the normal registers. */ - restore_gpr (0); - restore_gpr (1); - restore_gpr (2); - restore_gpr (3); - restore_gpr (4); - restore_gpr (5); - restore_gpr (6); - restore_gpr (7); - restore_gpr (8); - restore_gpr (9); - restore_gpr (10); - restore_gpr (11); - restore_gpr (12); - restore_gpr (13); - restore_gpr (14); - restore_gpr (15); - restore_gpr (16); - restore_gpr (17); - restore_gpr (18); - restore_gpr (19); - restore_gpr (20); - restore_gpr (21); - restore_gpr (22); - restore_gpr (23); - restore_gpr (24); - restore_gpr (25); - restore_gpr (26); - restore_gpr (27); - restore_gpr (28); - restore_gpr (29); - restore_gpr (30); - restore_gpr (31); - - /* Return. */ - asm volatile ("bctr"); /* XXX CTR is not restored! */ - - /* NOTREACHED */ - return -1; -} - -weak_alias (__sigreturn, sigreturn) diff --git a/libc/sysdeps/mach/hurd/powerpc/static-start.S b/libc/sysdeps/mach/hurd/powerpc/static-start.S deleted file mode 100644 index 7c4887547..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/static-start.S +++ /dev/null @@ -1,58 +0,0 @@ -/* Startup code for statically linked Hurd/PowerPC binaries. - Copyright (C) 1998,2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - - /* These are the various addresses we require. */ - .section ".rodata" - .align 2 - weak_extern(__libc_csu_init) - weak_extern(__libc_csu_fini) -L(start_addresses): - .long _SDA_BASE_ - .long JUMPTARGET(main) - .long JUMPTARGET(__libc_csu_init) - .long JUMPTARGET(__libc_csu_fini) - ASM_SIZE_DIRECTIVE(L(start_addresses)) - - .section ".text" -ENTRY(_start) - /* Save the stack pointer to pass to _hurd_stack_setup. */ - mr r3,r1 - /* Set up an initial stack frame. */ - li r0,0 - stwu r0,-16(r1) - /* Call _hurd_stack_setup. */ - bl JUMPTARGET(_hurd_stack_setup) - /* Pass the argument data to __libc_start_main. */ - addi r9,r1,16 - /* Clear the LR. */ - li r0,0 - mtlr r0 - /* Set r13 to point at the 'small data area', and put the address of - start_addresses in r8... */ - lis r8,L(start_addresses)@ha - lwzu r13,L(start_addresses)@l(r8) - /* and continue in libc-start, in glibc. */ - b JUMPTARGET(__libc_start_main) -END(_start) - -/* Define a symbol for the first piece of initialized data. */ - .section ".data" -__data_start: -weak_alias (__data_start, data_start) diff --git a/libc/sysdeps/mach/hurd/powerpc/trampoline.c b/libc/sysdeps/mach/hurd/powerpc/trampoline.c deleted file mode 100644 index da59a25fe..000000000 --- a/libc/sysdeps/mach/hurd/powerpc/trampoline.c +++ /dev/null @@ -1,256 +0,0 @@ -/* Set thread_state for sighandler, and sigcontext to recover. For PowerPC. - Copyright (C) 1994,1995,1996,1997,1998,1999,2001,2005 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include -#include -#include "hurdfault.h" -#include - -struct sigcontext * -_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler, - int signo, struct hurd_signal_detail *detail, - volatile int rpc_wait, - struct machine_thread_all_state *state) -{ - void trampoline (void); - void rpc_wait_trampoline (void); - void *volatile sigsp; - struct sigcontext *scp; - - if (ss->context) - { - /* We have a previous sigcontext that sigreturn was about - to restore when another signal arrived. We will just base - our setup on that. */ - if (! _hurdsig_catch_memory_fault (ss->context)) - { - memcpy (&state->basic, &ss->context->sc_ppc_thread_state, - sizeof (state->basic)); - memcpy (&state->exc, &ss->context->sc_ppc_exc_state, - sizeof (state->exc)); - memcpy (&state->fpu, &ss->context->sc_ppc_float_state, - sizeof (state->fpu)); - state->set = (1 << PPC_THREAD_STATE) | (1 << PPC_EXCEPTION_STATE) - | (1 << PPC_FLOAT_STATE); - } - } - - if (! machine_get_basic_state (ss->thread, state)) - return NULL; - - if ((ss->actions[signo].sa_flags & SA_ONSTACK) && - !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK))) - { - sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size; - ss->sigaltstack.ss_flags |= SS_ONSTACK; - /* XXX need to set up base of new stack for - per-thread variables, cthreads. */ - } - else - sigsp = (char *) state->basic.SP; - - /* Set up the sigcontext structure on the stack. This is all the stack - needs, since the args are passed in registers (below). */ - sigsp -= sizeof (*scp); - scp = sigsp; - sigsp -= 16; /* Reserve some space for a stack frame. */ - - if (_hurdsig_catch_memory_fault (scp)) - { - /* We got a fault trying to write the stack frame. - We cannot set up the signal handler. - Returning NULL tells our caller, who will nuke us with a SIGILL. */ - return NULL; - } - else - { - int ok; - - /* Set up the sigcontext from the current state of the thread. */ - - scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0; - - /* struct sigcontext is laid out so that starting at sc_srr0 - mimics a struct ppc_thread_state. */ - memcpy (&scp->sc_ppc_thread_state, - &state->basic, sizeof (state->basic)); - - /* struct sigcontext is laid out so that starting at sc_dar - mimics a struct ppc_exc_state. */ - ok = machine_get_state (ss->thread, state, PPC_EXCEPTION_STATE, - &state->exc, &scp->sc_ppc_exc_state, - sizeof (state->exc)); - - /* struct sigcontext is laid out so that starting at sc_fprs[0] - mimics a struct ppc_float_state. */ - if (ok) - ok = machine_get_state (ss->thread, state, PPC_FLOAT_STATE, - &state->fpu, &scp->sc_ppc_float_state, - sizeof (state->fpu)); - - _hurdsig_end_catch_fault (); - - if (!ok) - return NULL; - } - - /* Modify the thread state to call the trampoline code on the new stack. */ - if (rpc_wait) - { - /* The signalee thread was blocked in a mach_msg_trap system call, - still waiting for a reply. We will have it run the special - trampoline code which retries the message receive before running - the signal handler. - - To do this we change the OPTION argument in its registers to - enable only message reception, since the request message has - already been sent. */ - - /* The system call arguments are stored in consecutive registers - starting with r3. */ - struct mach_msg_trap_args *args = (void *) &state->basic.r3; - - if (_hurdsig_catch_memory_fault (args)) - { - /* Faulted accessing ARGS. Bomb. */ - return NULL; - } - - assert (args->option & MACH_RCV_MSG); - /* Disable the message-send, since it has already completed. The - calls we retry need only wait to receive the reply message. */ - args->option &= ~MACH_SEND_MSG; - - /* Limit the time to receive the reply message, in case the server - claimed that `interrupt_operation' succeeded but in fact the RPC - is hung. */ - args->option |= MACH_RCV_TIMEOUT; - args->timeout = _hurd_interrupted_rpc_timeout; - - _hurdsig_end_catch_fault (); - - state->basic.PC = (int) rpc_wait_trampoline; - /* After doing the message receive, the trampoline code will need to - update the r3 value to be restored by sigreturn. To simplify - the assembly code, we pass the address of its slot in SCP to the - trampoline code in r10. */ - state->basic.r10 = (long int) &scp->sc_gprs[3]; - /* We must preserve the mach_msg_trap args in r3..r9. - Pass the handler args to the trampoline code in r11..r13. */ - state->basic.r11 = signo; - state->basic.r12 = detail->code; - state->basic.r13 = (int) scp; - } - else - { - state->basic.PC = (int) trampoline; - state->basic.r3 = signo; - state->basic.r4 = detail->code; - state->basic.r5 = (int) scp; - } - - state->basic.r1 = (int) sigsp; /* r1 is the stack pointer. */ - - /* We pass the handler function to the trampoline code in ctr. */ - state->basic.ctr = (int) handler; - /* In r15, we store the address of __sigreturn itself, - for the trampoline code to use. */ - state->basic.r15 = (int) &__sigreturn; - /* In r16, we save the SCP value to pass to __sigreturn - after the handler returns. */ - state->basic.r16 = (int) scp; - - /* In r3, we store a pointer to the registers in STATE so that the - trampoline code can load the registers from that. For some reason, - thread_set_state doesn't set all registers. */ - state->basic.r17 = state->basic.r3; /* Store the real r3 in r17. */ - state->basic.r3 = (int) &state->basic.r0; - - return scp; -} - -/* The trampoline code follows. This used to be located inside - _hurd_setup_sighandler, but was optimized away by gcc 2.95. */ - -/* This function sets some registers which the trampoline code uses - and which are not automatically set by thread_set_state. - In r3 we have a pointer to the registers in STATE. */ -asm ("trampoline_load_registers:\n" - "lwz 17,68(3)\n" /* The real r3. */ - "lwz 4,16(3)\n" - "lwz 5,20(3)\n" - "lwz 6,24(3)\n" - "lwz 7,28(3)\n" - "lwz 8,32(3)\n" - "lwz 9,36(3)\n" - "lwz 10,40(3)\n" - "lwz 11,44(3)\n" - "lwz 12,48(3)\n" - "lwz 13,52(3)\n" - "lwz 14,56(3)\n" - "lwz 15,60(3)\n" - "lwz 16,64(3)\n" - "mr 3,17\n" - "blr\n"); - -asm ("rpc_wait_trampoline:\n"); - /* This is the entry point when we have an RPC reply message to receive - before running the handler. The MACH_MSG_SEND bit has already been - cleared in the OPTION argument in our registers. For our convenience, - r10 points to the sc_regs[3] member of the sigcontext (saved r3). */ - -asm (/* Retry the interrupted mach_msg system call. */ - "bl trampoline_load_registers\n" - "li 0, -25\n" /* mach_msg_trap */ - "sc\n" - /* When the sigcontext was saved, r3 was MACH_RCV_INTERRUPTED. But - now the message receive has completed and the original caller of - the RPC (i.e. the code running when the signal arrived) needs to - see the final return value of the message receive in r3. So - store the new r3 value into the sc_regs[3] member of the sigcontext - (whose address is in r10 to make this code simpler). */ - "stw 3, 0(10)\n" - /* Since the argument registers needed to have the mach_msg_trap - arguments, we've stored the arguments to the handler function - in registers r11..r13 of the state structure. */ - "mr 3,11\n" - "mr 4,12\n" - "mr 5,13\n"); - -asm ("trampoline:\n"); - /* Entry point for running the handler normally. The arguments to the - handler function are already in the standard registers: - - r3 SIGNO - r4 SIGCODE - r5 SCP - - r16 also contains SCP; this value is callee-saved (and so should not get - clobbered by running the handler). We use this saved value to pass to - __sigreturn, so the handler can clobber the argument registers if it - likes. */ -asm ("bl trampoline_load_registers\n" - "bctrl\n" /* Call the handler function. */ - "mtctr 15\n" /* Copy &__sigreturn to CTR. */ - "mr 3,16\n" /* Copy the saved SCP to r3. */ - "bctr\n" /* Call __sigreturn (SCP). */ - ); diff --git a/libc/sysdeps/mach/hurd/ptrace.c b/libc/sysdeps/mach/hurd/ptrace.c index bb5627284..bccb265fb 100644 --- a/libc/sysdeps/mach/hurd/ptrace.c +++ b/libc/sysdeps/mach/hurd/ptrace.c @@ -160,7 +160,7 @@ ptrace (enum __ptrace_request request, ... ) case PTRACE_SINGLESTEP: /* This is a machine-dependent kernel RPC on machines that support it. Punt. */ - return EOPNOTSUPP; + return __hurd_fail (EOPNOTSUPP); case PTRACE_ATTACH: case PTRACE_DETACH: @@ -227,7 +227,7 @@ ptrace (enum __ptrace_request request, ... ) case PTRACE_PEEKUSER: case PTRACE_POKEUSER: /* U area, what's that? */ - return EOPNOTSUPP; + return __hurd_fail (EOPNOTSUPP); case PTRACE_GETREGS: case PTRACE_SETREGS: @@ -248,7 +248,7 @@ ptrace (enum __ptrace_request request, ... ) return get_regs (MACHINE_THREAD_FLOAT_STATE_FLAVOR, MACHINE_THREAD_FLOAT_STATE_COUNT); #else - return EOPNOTSUPP; + return __hurd_fail (EOPNOTSUPP); #endif case PTRACE_GETFPAREGS: @@ -261,7 +261,7 @@ ptrace (enum __ptrace_request request, ... ) return get_regs (MACHINE_THREAD_FPA_STATE_FLAVOR, MACHINE_THREAD_FPA_STATE_COUNT); #else - return EOPNOTSUPP; + return __hurd_fail (EOPNOTSUPP); #endif case PTRACE_POKETEXT: diff --git a/libc/sysdeps/mach/powerpc/machine-lock.h b/libc/sysdeps/mach/powerpc/machine-lock.h deleted file mode 100644 index 84159c5a5..000000000 --- a/libc/sysdeps/mach/powerpc/machine-lock.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Machine-specific definition for spin locks. PowerPC version. - Copyright (C) 1994-2012 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MACHINE_LOCK_H -#define _MACHINE_LOCK_H - -/* The type of a spin lock variable. */ - -typedef volatile long int __spin_lock_t; - -/* Value to initialize `__spin_lock_t' variables to. */ - -#define __SPIN_LOCK_INITIALIZER 0L - - -#ifndef _EXTERN_INLINE -#define _EXTERN_INLINE __extern_inline -#endif - -/* Unlock LOCK. */ - -_EXTERN_INLINE void -__spin_unlock (__spin_lock_t *__lock) -{ - long int __locked; - __asm__ __volatile__ ("\ -0: lwarx %0,0,%1\n\ - stwcx. %2,0,%1\n\ - bne- 0b\n\ -" : "=&r" (__locked) : "r" (__lock), "r" (0) : "cr0"); -} - -/* Try to lock LOCK; return nonzero if we locked it, zero if another has. */ - -_EXTERN_INLINE int -__spin_try_lock (register __spin_lock_t *__lock) -{ - long int __rtn; - __asm__ __volatile__ ("\ -0: lwarx %0,0,%1\n\ - stwcx. %2,0,%1\n\ - bne- 0b\n\ -" : "=&r" (__rtn) : "r" (__lock), "r" (1) : "cr0"); - return !__rtn; -} - -/* Return nonzero if LOCK is locked. */ - -_EXTERN_INLINE int -__spin_lock_locked (__spin_lock_t *__lock) -{ - long int __rtn; - __asm__ __volatile__ ("\ -0: lwarx %0,0,%1\n\ - stwcx. %0,0,%1\n\ - bne- 0b\n\ -" : "=&r" (__rtn) : "r" (__lock) : "cr0"); - return __rtn; -} - - -#endif /* machine-lock.h */ diff --git a/libc/sysdeps/mach/powerpc/machine-sp.h b/libc/sysdeps/mach/powerpc/machine-sp.h deleted file mode 100644 index 7f75184b8..000000000 --- a/libc/sysdeps/mach/powerpc/machine-sp.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Machine-specific function to return the stack pointer. PowerPC version. - Copyright (C) 2001, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#ifndef _MACHINE_SP_H -#define _MACHINE_SP_H - -/* Return the current stack pointer. */ - -#ifndef _EXTERN_INLINE -/* Make sure this function is included in hurd/threadvar-inlines.c. */ -# ifdef _HURD_THREADVAR_H_EXTERN_INLINE -# define _EXTERN_INLINE _HURD_THREADVAR_H_EXTERN_INLINE -# else -# define _EXTERN_INLINE __extern_inline -# endif -#endif - -_EXTERN_INLINE void * -__thread_stack_pointer (void) -{ - register void *__sp__; - __asm__ ("mr %0, 1" : "=r" (__sp__)); - return __sp__; -} - -#endif /* machine-sp.h */ diff --git a/libc/sysdeps/mach/powerpc/syscall.S b/libc/sysdeps/mach/powerpc/syscall.S deleted file mode 100644 index 77640e375..000000000 --- a/libc/sysdeps/mach/powerpc/syscall.S +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -ENTRY (syscall) - mr r0,r3 - mr r3,r4 - mr r4,r5 - mr r5,r6 - mr r6,r7 - mr r7,r8 - sc - blr -END (syscall) diff --git a/libc/sysdeps/mach/powerpc/sysdep.h b/libc/sysdeps/mach/powerpc/sysdep.h deleted file mode 100644 index f2d863e75..000000000 --- a/libc/sysdeps/mach/powerpc/sysdep.h +++ /dev/null @@ -1,50 +0,0 @@ -/* system call details for Mach on PowerPC - Copyright (C) 2001,02 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#ifndef _MACH_POWERPC_SYSDEP_H -#define _MACH_POWERPC_SYSDEP_H - -#define START_ARGS char **sparg -#define SNARF_ARGS(argc, argv, envp) \ - do { \ - argv = &sparg[1]; \ - argc = *(int *)sparg; \ - envp = &argv[argc + 1]; \ - } while (0) - -#define CALL_WITH_SP(fn, sp) \ - do { \ - register long __sp = (long) sp, __fn = (long) fn; \ - asm volatile ("mr 1, %0; mtlr %1; blr" \ - : : "r" (__sp), "r" (__fn)); \ - } while (0) - -#define STACK_GROWTH_DOWN - -#define RETURN_TO(sp, pc, retval) \ - asm volatile ("mr 1, %0; mtctr %1; mr 3, %2; bctr" \ - : : "r" (sp), "r" (pc), "r" (retval)) - -/* Get the machine-independent Mach definitions. */ -#define _MACH_MACHINE_ASM_H 1 /* Kludge to avoid bad Darwin header file. */ -#include - -#undef ENTRY -#include - -#endif /* _MACH_POWERPC_SYSDEP_H */ diff --git a/libc/sysdeps/mach/powerpc/thread_state.h b/libc/sysdeps/mach/powerpc/thread_state.h deleted file mode 100644 index d11a5ab01..000000000 --- a/libc/sysdeps/mach/powerpc/thread_state.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Mach thread state definitions for machine-independent code. PowerPC version - Copyright (C) 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -#include - -#define MACHINE_THREAD_STATE_FLAVOR PPC_THREAD_STATE -#define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT - -#define machine_thread_state ppc_thread_state - -#define PC srr0 -#define SP r1 -#define SYSRETURN r3 - -struct machine_thread_all_state - { - int set; /* Mask of bits (1 << FLAVOR). */ - struct ppc_thread_state basic; - struct ppc_exception_state exc; - struct ppc_float_state fpu; - }; - -#include diff --git a/libc/sysdeps/posix/getaddrinfo.c b/libc/sysdeps/posix/getaddrinfo.c index 672571ef2..3cc244b7f 100644 --- a/libc/sysdeps/posix/getaddrinfo.c +++ b/libc/sysdeps/posix/getaddrinfo.c @@ -2672,7 +2672,7 @@ getaddrinfo (const char *name, const char *service, } libc_hidden_def (getaddrinfo) -static_link_warning (getaddrinfo) +nss_interface_function (getaddrinfo) void freeaddrinfo (struct addrinfo *ai) diff --git a/libc/sysdeps/powerpc/Makefile b/libc/sysdeps/powerpc/Makefile index 79dd6fa97..7442b6709 100644 --- a/libc/sysdeps/powerpc/Makefile +++ b/libc/sysdeps/powerpc/Makefile @@ -1,7 +1,3 @@ -# We always want to use the new mnemonic syntax even if we are on a RS6000 -# machine. -+cflags += -mnew-mnemonics - ifeq ($(subdir),string) CFLAGS-memcmp.c += -Wno-uninitialized endif diff --git a/libc/sysdeps/powerpc/bits/fenv.h b/libc/sysdeps/powerpc/bits/fenv.h index 817feaa7f..43e0f4c73 100644 --- a/libc/sysdeps/powerpc/bits/fenv.h +++ b/libc/sysdeps/powerpc/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2004, 2006,2008 Free Software Foundation, Inc. +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,16 +25,21 @@ the appropriate bits in the SPEFSCR... */ enum { - FE_INEXACT = 1 << (63 - 42), -#define FE_INEXACT FE_INEXACT - FE_INVALID = 1 << (63 - 43), -#define FE_INVALID FE_INVALID - FE_DIVBYZERO = 1 << (63 - 44), -#define FE_DIVBYZERO FE_DIVBYZERO - FE_UNDERFLOW = 1 << (63 - 45), -#define FE_UNDERFLOW FE_UNDERFLOW - FE_OVERFLOW = 1 << (63 - 46) -#define FE_OVERFLOW FE_OVERFLOW + FE_INEXACT = +#define FE_INEXACT (1 << (63 - 42)) + FE_INEXACT, + FE_INVALID = +#define FE_INVALID (1 << (63 - 43)) + FE_INVALID, + FE_DIVBYZERO = +#define FE_DIVBYZERO (1 << (63 - 44)) + FE_DIVBYZERO, + FE_UNDERFLOW = +#define FE_UNDERFLOW (1 << (63 - 45)) + FE_UNDERFLOW, + FE_OVERFLOW = +#define FE_OVERFLOW (1 << (63 - 46)) + FE_OVERFLOW }; #define FE_ALL_EXCEPT \ @@ -45,14 +50,18 @@ enum macros. */ enum { - FE_TONEAREST = 0, -#define FE_TONEAREST FE_TONEAREST - FE_TOWARDZERO = 1, -#define FE_TOWARDZERO FE_TOWARDZERO - FE_UPWARD = 2, -#define FE_UPWARD FE_UPWARD - FE_DOWNWARD = 3 -#define FE_DOWNWARD FE_DOWNWARD + FE_TONEAREST = +#define FE_TONEAREST 0 + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO 1 + FE_TOWARDZERO, + FE_UPWARD = +#define FE_UPWARD 2 + FE_UPWARD, + FE_DOWNWARD = +#define FE_DOWNWARD 3 + FE_DOWNWARD }; /* Type representing exception flags. */ @@ -84,14 +93,18 @@ extern const fenv_t *__fe_nomask_env (void); the appropriate bits in the FPSCR... */ enum { - FE_INEXACT = 1 << (31 - 6), -#define FE_INEXACT FE_INEXACT - FE_DIVBYZERO = 1 << (31 - 5), -#define FE_DIVBYZERO FE_DIVBYZERO - FE_UNDERFLOW = 1 << (31 - 4), -#define FE_UNDERFLOW FE_UNDERFLOW - FE_OVERFLOW = 1 << (31 - 3), -#define FE_OVERFLOW FE_OVERFLOW + FE_INEXACT = +#define FE_INEXACT (1 << (31 - 6)) + FE_INEXACT, + FE_DIVBYZERO = +#define FE_DIVBYZERO (1 << (31 - 5)) + FE_DIVBYZERO, + FE_UNDERFLOW = +#define FE_UNDERFLOW (1 << (31 - 4)) + FE_UNDERFLOW, + FE_OVERFLOW = +#define FE_OVERFLOW (1 << (31 - 3)) + FE_OVERFLOW, /* ... except for FE_INVALID, for which we use bit 31. FE_INVALID actually corresponds to bits 7 through 12 and 21 through 23 @@ -99,8 +112,9 @@ enum says that it must be a power of 2. Instead we use bit 2 which is the summary bit for all the FE_INVALID exceptions, which kind of makes sense. */ - FE_INVALID = 1 << (31 - 2), -#define FE_INVALID FE_INVALID + FE_INVALID = +#define FE_INVALID (1 << (31 - 2)) + FE_INVALID, #ifdef __USE_GNU /* Breakdown of the FE_INVALID bits. Setting FE_INVALID on an @@ -110,43 +124,52 @@ enum enable these exceptions individually. */ /* Operation with SNaN. */ - FE_INVALID_SNAN = 1 << (31 - 7), -# define FE_INVALID_SNAN FE_INVALID_SNAN + FE_INVALID_SNAN = +# define FE_INVALID_SNAN (1 << (31 - 7)) + FE_INVALID_SNAN, /* Inf - Inf */ - FE_INVALID_ISI = 1 << (31 - 8), -# define FE_INVALID_ISI FE_INVALID_ISI + FE_INVALID_ISI = +# define FE_INVALID_ISI (1 << (31 - 8)) + FE_INVALID_ISI, /* Inf / Inf */ - FE_INVALID_IDI = 1 << (31 - 9), -# define FE_INVALID_IDI FE_INVALID_IDI + FE_INVALID_IDI = +# define FE_INVALID_IDI (1 << (31 - 9)) + FE_INVALID_IDI, /* 0 / 0 */ - FE_INVALID_ZDZ = 1 << (31 - 10), -# define FE_INVALID_ZDZ FE_INVALID_ZDZ + FE_INVALID_ZDZ = +# define FE_INVALID_ZDZ (1 << (31 - 10)) + FE_INVALID_ZDZ, /* Inf * 0 */ - FE_INVALID_IMZ = 1 << (31 - 11), -# define FE_INVALID_IMZ FE_INVALID_IMZ + FE_INVALID_IMZ = +# define FE_INVALID_IMZ (1 << (31 - 11)) + FE_INVALID_IMZ, /* Comparison with NaN or SNaN. */ - FE_INVALID_COMPARE = 1 << (31 - 12), -# define FE_INVALID_COMPARE FE_INVALID_COMPARE + FE_INVALID_COMPARE = +# define FE_INVALID_COMPARE (1 << (31 - 12)) + FE_INVALID_COMPARE, /* Invalid operation flag for software (not set by hardware). */ /* Note that some chips don't have this implemented, presumably because no-one expected anyone to write software for them %-). */ - FE_INVALID_SOFTWARE = 1 << (31 - 21), -# define FE_INVALID_SOFTWARE FE_INVALID_SOFTWARE + FE_INVALID_SOFTWARE = +# define FE_INVALID_SOFTWARE (1 << (31 - 21)) + FE_INVALID_SOFTWARE, /* Square root of negative number (including -Inf). */ /* Note that some chips don't have this implemented. */ - FE_INVALID_SQRT = 1 << (31 - 22), -# define FE_INVALID_SQRT FE_INVALID_SQRT + FE_INVALID_SQRT = +# define FE_INVALID_SQRT (1 << (31 - 22)) + FE_INVALID_SQRT, /* Conversion-to-integer of a NaN or a number too large or too small. */ - FE_INVALID_INTEGER_CONVERSION = 1 << (31 - 23) -# define FE_INVALID_INTEGER_CONVERSION FE_INVALID_INTEGER_CONVERSION + FE_INVALID_INTEGER_CONVERSION = +# define FE_INVALID_INTEGER_CONVERSION (1 << (31 - 23)) + FE_INVALID_INTEGER_CONVERSION # define FE_ALL_INVALID \ (FE_INVALID_SNAN | FE_INVALID_ISI | FE_INVALID_IDI | FE_INVALID_ZDZ \ @@ -163,14 +186,18 @@ enum appropriate macros. */ enum { - FE_TONEAREST = 0, -#define FE_TONEAREST FE_TONEAREST - FE_TOWARDZERO = 1, -#define FE_TOWARDZERO FE_TOWARDZERO - FE_UPWARD = 2, -#define FE_UPWARD FE_UPWARD - FE_DOWNWARD = 3 -#define FE_DOWNWARD FE_DOWNWARD + FE_TONEAREST = +#define FE_TONEAREST 0 + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO 1 + FE_TOWARDZERO, + FE_UPWARD = +#define FE_UPWARD 2 + FE_UPWARD, + FE_DOWNWARD = +#define FE_DOWNWARD 3 + FE_DOWNWARD }; /* Type representing exception flags. */ diff --git a/libc/sysdeps/powerpc/fpu/fclrexcpt.c b/libc/sysdeps/powerpc/fpu/fclrexcpt.c index 87376bfe9..e99cc58ac 100644 --- a/libc/sysdeps/powerpc/fpu/fclrexcpt.c +++ b/libc/sysdeps/powerpc/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,4 +44,5 @@ strong_alias (__feclearexcept, __old_feclearexcept) compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1); #endif +libm_hidden_ver (__feclearexcept, feclearexcept) versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2); diff --git a/libc/sysdeps/powerpc/fpu/libm-test-ulps b/libc/sysdeps/powerpc/fpu/libm-test-ulps index ffb8e3a95..b37806582 100644 --- a/libc/sysdeps/powerpc/fpu/libm-test-ulps +++ b/libc/sysdeps/powerpc/fpu/libm-test-ulps @@ -760,6 +760,35 @@ float: 2 ifloat: 2 # clog +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 2.649094276923003995420209214900915462737e-10 + 3.141592653589793238462643383279502884197 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 2.649094282537168795982991778475646793277e-10 + 3.141592652530155111500161671113150737892 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog (-0x1.234566p-40 - 1.0 i) == 5.354083939753840089583620652120903838944e-25 - 1.570796326795931422008642456283782656359 i": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + pi i": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - pi i": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i": +float: 1 +ifloat: 1 Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": float: 3 ifloat: 3 @@ -773,15 +802,71 @@ ldouble: 2 Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": ildouble: 1 ldouble: 1 +Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -5.960464655174753498633255797994360530379e-8 + 7.888609052210118054117285652827862296732e-31 i": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i": +float: 1 +ifloat: 1 Test "Imaginary part of: clog (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 709.8942846690411016323109979483151967689 + 0.4636476090008061606231772164674799632783 i": double: 1 idouble: 1 +Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + +0 i": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - 0 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (0x11682p-23 + 0x7ffed1p-23 i) == 1.1723955140027907954461000991619077811832e-12 + 1.5622968405332756349813737986164832897108 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x155f8afc4c48685bf63610p-85 + 0x17d0cf2652cdbeb1294e19p-85 i) == -4.7775669192897997174762089350332738583822e-50 + 0.8393953487996880419413728440067635213372 i": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: clog (0x15cfbd1990d1ffp-53 + 0x176a3973e09a9ap-53 i) == 1.0168910106364605304135563536838075568606e-30 + 0.8208373755522359859870890246475340086663 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x187190c1a334497bdbde5a95f48p-106 + 0x3b25f08062d0a095c4cfbbc338dp-106 i) == -1.7471844652198029695350765775994001163767e-63 + 1.1789110097072986038243729592318526094314 i": +ildouble: 1 +ldouble: 1 Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i": double: 1 idouble: 1 Test "Real part of: clog (0x1p-147 + 0x1p-147 i) == -101.5460619520319878296245057936228672231 + pi/4 i": float: 1 ifloat: 1 +Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i) == 1.5366822245016167178749091974664853785194e-08 + 1.2522014929038946066987318471922169174157 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog (0x4d4ep-15 + 0x6605p-15 i) == -1.6298145321400412054744424587143483169412e-08 + 0.9223574537155056772124552172295398141249 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog (0x4d9c37e2b5cb4533p-63 + 0x65c98be2385a042ep-63 i) == 6.4064442119814669184296141278612389400075e-37 + 0.9193591364645830864185131402313014890145 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x6241ef0da53f539f02fad67dabp-106 + 0x3fb46641182f7efd9caa769dac0p-106 i) == 4.3299788920664682288477984749202524623248e-63 + 1.4746938237585656250866370987773473745867 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0xa1f2c1p-24 + 0xc643aep-24 i) == -1.0480505352462576151523512837107080269981e-13 + 0.8858771987699967480545613322309315260313 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0xa4722f19346cp-51 + 0x7f9631c5e7f07p-51 i) == -6.2122796286154679676173624516405339768606e-30 + 1.4904138780720095276446375492434049214172 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0xf2p-10 + 0x3e3p-10 i) == 6.1988446308070710970664736815277450078106e-06 + 1.3322126499153926210226335249558203898460 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i": +float: 1 +ifloat: 1 # clog10 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": @@ -798,6 +883,69 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 1.150487026509145544402795327729455391948e-10 + 1.364376353841841347485783625431355770210 i": +double: 2 +idouble: 2 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i) == 1.150487026509145544402795327729455391948e-10 + 1.364376353841841347485783625431355770210 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 1.150487028947346337782682105935961875822e-10 + 1.364376353381646356131680448946397884147 i": +double: 2 +idouble: 2 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i) == 1.150487028947346337782682105935961875822e-10 + 1.364376353381646356131680448946397884147 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i) == 308.2409272754311106024666378243768099991 + 1.364376353841841347485783625431355770210 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i) == 308.2409272754311106024666378243768099991 - 1.364376353841841347485783625431355770210 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i) == 2.556638434669064077889576526006849923281e-13 + 1.364375882602207106407956770293808181427 i": +double: 1 +idouble: 1 Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": double: 1 idouble: 1 @@ -870,8 +1018,40 @@ ldouble: 1 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": float: 2 ifloat: 2 -ildouble: 3 -ldouble: 3 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i) == -4.821637332766435821255375046554377090472e-17 + 4.053112396770095089737411317782466262176e-302 i": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -2.588596909321764128428416045209904492216e-8 + 3.425979381266895667295625489912064603415e-31 i": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-100 i) == 3.577293486783822178310971763308187385546e-5 + 3.897399639875661463735636919790792140598e-31 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i) == 2.438200411482400072282924063740535840474e-19 + 6.821881764607257184291586401763604544928e-1 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i) == 2.217530356103816369479108963807448194409e-31 + 6.821881769209202348667823902864283966959e-1 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i) == 2.114801746467415208319767917450504756866e-37 + 6.821881769209206733143018621078368211515e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i": double: 1 float: 1 @@ -890,11 +1070,45 @@ ldouble: 1 Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 308.3031705664207720674749211936626341569 + 0.2013595981366865903254995612594728746470 i": double: 1 idouble: 1 +Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i) == 1.3918041236396763648388478552321724382899e-29 + 0.6263795733790237053262025311642907438291 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i) == 1.3918041236396763648388478552321724382899e-29 + 0.6263795733790237053262025311642907438291 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x155f8afc4c48685bf63610p-85 + 0x17d0cf2652cdbeb1294e19p-85 i) == -2.0748709499710785084693619097712106753591e-50 + 0.3645447681189598740620098186365764884771 i": +ildouble: 2 +ldouble: 2 +Test "Real part of: clog10 (0x15d8ab6ed05ca514086ac3a1e84p-105 + 0x1761e480aa094c0b10b34b09ce9p-105 i) == 4.3548095442952115860848857519953610343042e-63 + 0.3558376234889641500775150477035448866763 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i) == -1.3155760824064879362415202279780039150764e-26 + 0.3473590599762514228227328130640352044313 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i) == -6.2126412844802358329771948751248003038444e-07 + 0.4977135139537443711784513409096950995985 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1df515eb171a808b9e400266p-95 + 0x7c71eb0cd4688dfe98581c77p-95 i) == -1.5221162575729652613635150540947625639689e-57 + 0.5795934880811949230121092882659698986043 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i": double: 1 idouble: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i": double: 1 idouble: 1 @@ -903,6 +1117,11 @@ double: 1 idouble: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i": double: 1 float: 1 @@ -910,6 +1129,13 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i": double: 1 float: 1 @@ -917,6 +1143,102 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i) == 7.730698388614835910296270976605350994446e-308 + 6.821881769209206737428918127156778851051e-1 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i) == 1.932674597153708977574067744151337748612e-308 + 6.821881769209206737428918127156778851051e-1 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i) == 4.831686492884272443935169360378344371529e-309 + 6.821881769209206737428918127156778851051e-1 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i) == 4.084085680564517578238994467153626207224e-38 + 6.821881769209206735545466044044889962925e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i) == 1.021021420141129394559748616788406551878e-38 + 6.821881769209206736487192085600834406988e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i) == 2.552553550352823486399371541971016379740e-39 + 6.821881769209206736958055106378806629019e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x298c62cb546588a7p-63 + 0x7911b1dfcc4ecdaep-63 i) == -5.1816837072162316773907242302011632570857e-37 + 0.5386167838952956925896424154370364458140 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i) == 1.9312741086596516918394613098872836703188e-20 + 0.5231613813514771042838490538484014771862 i": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i) == -6.4375803621988389731799033530075237868110e-21 + 0.4378257977686804492768642780897650927167 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x4d4ep-15 + 0x6605p-15 i) == -7.0781945783414996953799915941870192015212e-09 + 0.4005747524909781155537088181659175147564 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i) == 3.6079845358966994996207055940336690133424e-30 + 0.5243112258263349992771652393178033846555 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x81b7efa81fc35ad1p-65 + 0x1ef4b835f1c79d812p-65 i) == -4.3074341162203896332989394770760901408798e-39 + 0.5709443672155660428417571212549720987784 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i) == -1.7182001068739620267773842120965071561416e-11 + 0.3990121149225253562859800593935899629087 i": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i) == 2.3329549194675052736016290082882121135546e-26 + 0.4561756099441139182878993697611751382976 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": double: 1 float: 1 @@ -947,6 +1269,12 @@ ildouble: 1 ldouble: 1 # cos +Test "cos (0x1p+120) == -9.25879022854837867303861764107414946730833e-01": +float: 1 +ifloat: 1 +Test "cos (0x1p+127) == 7.81914638714960072263910298466369236613162e-01": +float: 1 +ifloat: 1 Test "cos (16.0) == -0.9576594803233846418996372326511034717803": ildouble: 2 ldouble: 2 @@ -1128,6 +1456,8 @@ double: 1 float: 4 idouble: 1 ifloat: 4 +ildouble: 2 +ldouble: 2 Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": float: 1 ifloat: 1 @@ -1141,6 +1471,8 @@ double: 2 float: 4 idouble: 2 ifloat: 4 +ildouble: 4 +ldouble: 4 Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": float: 1 ifloat: 1 @@ -1255,6 +1587,9 @@ ildouble: 1 ldouble: 1 # csqrt +Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i) == 4.934094449071842328766868579214125217132e-20 - 1.191195773697904627170323731331667740087e-19 i": +double: 1 +idouble: 1 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": float: 1 ifloat: 1 @@ -1273,6 +1608,9 @@ idouble: 1 Test "Imaginary part of: csqrt (0 - 1 i) == M_SQRT_2_2 - M_SQRT_2_2 i": double: 1 idouble: 1 +Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i) == 1.191195773697904627170323731331667740087e-19 + 4.934094449071842328766868579214125217132e-20 i": +double: 1 +idouble: 1 Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i) == 1.844674352395372953599975585936590505260e+19 + 2.710505511993121390769065968615872097053e-20 i": float: 1 ifloat: 1 @@ -1293,6 +1631,9 @@ idouble: 1 Test "Imaginary part of: csqrt (0x1p-1073 + 0x1p-1073 i) == 3.453664695497464982856905711457966660085e-162 + 1.430554756764195530630723976279903095110e-162 i": double: 1 idouble: 1 +Test "Imaginary part of: csqrt (0x1p-1074 + 0x1p-1074 i) == 2.442109726130830256743814843868934877597e-162 + 1.011554969366634726113090867589031782487e-162 i": +ildouble: 1 +ldouble: 1 Test "Real part of: csqrt (0x1p-147 + 0x1p-147 i) == 8.225610928685557596194006925540350401606e-23 + 3.407159605465907500737319471202779419102e-23 i": double: 1 idouble: 1 @@ -1391,8 +1732,8 @@ ldouble: 1 # ctan_towardzero Test "Real part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": -ldouble: 4 ildouble: 4 +ldouble: 4 Test "Imaginary part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ildouble: 13 ldouble: 13 @@ -1435,9 +1776,8 @@ ldouble: 1 Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": double: 1 float: 2 -idouble: 1 -ifloat: 2 idouble: 2 +ifloat: 2 ildouble: 2 ldouble: 2 Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": @@ -1469,8 +1809,8 @@ Test "Real part of: ctanh (1 + 0x1p1023 i) == 0.87860631188830686954625402262198 ildouble: 1 ldouble: 1 Test "Imaginary part of: ctanh (1 + 0x1p1023 i) == 0.8786063118883068695462540226219865087189 - 0.2254627924997545057926782581695274244229 i": -idouble: 1 double: 1 +idouble: 1 Test "Real part of: ctanh (1 + 0x1p127 i) == 0.9101334047676183761532873794426475906201 + 0.2446359391192790896381501310437708987204 i": double: 1 float: 1 @@ -2114,6 +2454,12 @@ float: 1 ifloat: 1 # sincos +Test "sincos (0x1p+120, &sin_res, &cos_res) puts -9.25879022854837867303861764107414946730833e-01 in cos_res": +float: 1 +ifloat: 1 +Test "sincos (0x1p+127, &sin_res, &cos_res) puts 7.81914638714960072263910298466369236613162e-01 in cos_res": +float: 1 +ifloat: 1 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": double: 1 float: 1 @@ -2185,6 +2531,60 @@ double: 1 idouble: 1 # tan +Test "tan (-0xc.908p-4) == -0.9997603425502441410973077452249560802034": +ildouble: 2 +ldouble: 2 +Test "tan (-0xc.90cp-4) == -0.9998823910588060302788513970802357770031": +ildouble: 2 +ldouble: 2 +Test "tan (-0xc.90ep-4) == -0.9999434208994808753305784795924711152508": +ildouble: 2 +ldouble: 2 +Test "tan (-0xc.90f8p-4) == -0.9999891957244072765118898375645469865764": +ildouble: 2 +ldouble: 2 +Test "tan (-0xc.90fcp-4) == -0.9999968250656122402859679132395522927393": +ildouble: 1 +ldouble: 1 +Test "tan (-0xc.90fd8p-4) == -0.9999996860835706212861509874451585282616": +ildouble: 1 +ldouble: 1 +Test "tan (-0xc.90fdap-4) == -0.9999999245021033010474530133665235922808": +ildouble: 1 +ldouble: 1 +Test "tan (-0xc.92p-4) == -1.0004928571392300571266638743539017593717": +ildouble: 1 +ldouble: 1 +Test "tan (-0xc.9p-4) == -0.9995162902115457818029468900654150261381": +ildouble: 1 +ldouble: 1 +Test "tan (0xc.908p-4) == 0.9997603425502441410973077452249560802034": +ildouble: 2 +ldouble: 2 +Test "tan (0xc.90cp-4) == 0.9998823910588060302788513970802357770031": +ildouble: 2 +ldouble: 2 +Test "tan (0xc.90ep-4) == 0.9999434208994808753305784795924711152508": +ildouble: 2 +ldouble: 2 +Test "tan (0xc.90f8p-4) == 0.9999891957244072765118898375645469865764": +ildouble: 2 +ldouble: 2 +Test "tan (0xc.90fcp-4) == 0.9999968250656122402859679132395522927393": +ildouble: 1 +ldouble: 1 +Test "tan (0xc.90fd8p-4) == 0.9999996860835706212861509874451585282616": +ildouble: 1 +ldouble: 1 +Test "tan (0xc.90fdap-4) == 0.9999999245021033010474530133665235922808": +ildouble: 1 +ldouble: 1 +Test "tan (0xc.92p-4) == 1.0004928571392300571266638743539017593717": +ildouble: 1 +ldouble: 1 +Test "tan (0xc.9p-4) == 0.9995162902115457818029468900654150261381": +ildouble: 1 +ldouble: 1 Test "tan (pi/4) == 1": double: 1 idouble: 1 @@ -2721,32 +3121,32 @@ double: 1 float: 2 idouble: 1 ifloat: 2 -ildouble: 2 -ldouble: 2 +ildouble: 1 +ldouble: 1 Function: Imaginary part of "clog": double: 1 float: 3 idouble: 1 ifloat: 3 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Function: Real part of "clog10": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 -ildouble: 3 -ldouble: 3 +ildouble: 2 +ldouble: 2 Function: Imaginary part of "clog10": double: 1 float: 1 idouble: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Function: "cos": double: 2 @@ -2809,8 +3209,8 @@ double: 2 float: 5 idouble: 2 ifloat: 5 -ildouble: 2 -ldouble: 2 +ildouble: 4 +ldouble: 4 Function: Imaginary part of "cpow": double: 2 @@ -3223,8 +3623,8 @@ idouble: 1 Function: "tan": double: 1 idouble: 1 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Function: "tan_downward": float: 1 diff --git a/libc/sysdeps/powerpc/sys/platform/ppc.h b/libc/sysdeps/powerpc/sys/platform/ppc.h index 3780f57ba..58948e837 100644 --- a/libc/sysdeps/powerpc/sys/platform/ppc.h +++ b/libc/sysdeps/powerpc/sys/platform/ppc.h @@ -19,6 +19,7 @@ #ifndef _SYS_PLATFORM_PPC_H #define _SYS_PLATFORM_PPC_H 1 +#include #include #include @@ -26,13 +27,16 @@ static inline uint64_t __ppc_get_timebase (void) { -#ifdef __powerpc64__ +#if __GNUC_PREREQ (4, 8) + return __builtin_ppc_get_timebase (); +#else +# ifdef __powerpc64__ uint64_t __tb; /* "volatile" is necessary here, because the user expects this assembly isn't moved after an optimization. */ __asm__ volatile ("mfspr %0, 268" : "=r" (__tb)); return __tb; -#else /* not __powerpc64__ */ +# else /* not __powerpc64__ */ uint32_t __tbu, __tbl, __tmp; \ __asm__ volatile ("0:\n\t" "mftbu %0\n\t" @@ -42,7 +46,8 @@ __ppc_get_timebase (void) "bne- 0b" : "=r" (__tbu), "=r" (__tbl), "=r" (__tmp)); return (((uint64_t) __tbu << 32) | __tbl); -#endif /* not __powerpc64__ */ +# endif /* not __powerpc64__ */ +#endif } #endif /* sys/platform/ppc.h */ diff --git a/libc/sysdeps/pthread/aio_notify.c b/libc/sysdeps/pthread/aio_notify.c index f8c4ccc96..a9f0648c2 100644 --- a/libc/sysdeps/pthread/aio_notify.c +++ b/libc/sysdeps/pthread/aio_notify.c @@ -95,7 +95,7 @@ __aio_notify_only (struct sigevent *sigev) else if (sigev->sigev_notify == SIGEV_SIGNAL) { /* We have to send a signal. */ -#if _POSIX_REALTIME_SIGNALS +#if _POSIX_REALTIME_SIGNALS > 0 /* Note that the standard gives us the option of using a plain non-queuing signal here when SA_SIGINFO is not set for the signal. */ # ifdef BROKEN_THREAD_SIGNALS diff --git a/libc/sysdeps/s390/fpu/bits/fenv.h b/libc/sysdeps/s390/fpu/bits/fenv.h index 6df7b177f..88c6f7ac0 100644 --- a/libc/sysdeps/s390/fpu/bits/fenv.h +++ b/libc/sysdeps/s390/fpu/bits/fenv.h @@ -24,16 +24,21 @@ of the appropriate bits in the FPU control word. */ enum { - FE_INVALID = 0x80, -#define FE_INVALID FE_INVALID - FE_DIVBYZERO = 0x40, -#define FE_DIVBYZERO FE_DIVBYZERO - FE_OVERFLOW = 0x20, -#define FE_OVERFLOW FE_OVERFLOW - FE_UNDERFLOW = 0x10, -#define FE_UNDERFLOW FE_UNDERFLOW - FE_INEXACT = 0x08 -#define FE_INEXACT FE_INEXACT + FE_INVALID = +#define FE_INVALID 0x80 + FE_INVALID, + FE_DIVBYZERO = +#define FE_DIVBYZERO 0x40 + FE_DIVBYZERO, + FE_OVERFLOW = +#define FE_OVERFLOW 0x20 + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW 0x10 + FE_UNDERFLOW, + FE_INEXACT = +#define FE_INEXACT 0x08 + FE_INEXACT }; /* We dont use the y bit of the DXC in the floating point control register as glibc has no FE encoding for fe inexact incremented @@ -48,14 +53,18 @@ enum enum { - FE_TONEAREST = 0, -#define FE_TONEAREST FE_TONEAREST - FE_DOWNWARD = 0x3, -#define FE_DOWNWARD FE_DOWNWARD - FE_UPWARD = 0x2, -#define FE_UPWARD FE_UPWARD - FE_TOWARDZERO = 0x1 -#define FE_TOWARDZERO FE_TOWARDZERO + FE_TONEAREST = +#define FE_TONEAREST 0 + FE_TONEAREST, + FE_DOWNWARD = +#define FE_DOWNWARD 0x3 + FE_DOWNWARD, + FE_UPWARD = +#define FE_UPWARD 0x2 + FE_UPWARD, + FE_TOWARDZERO = +#define FE_TOWARDZERO 0x1 + FE_TOWARDZERO }; @@ -67,8 +76,8 @@ typedef unsigned int fexcept_t; /* size of fpc */ to the layout of the block written by the `fstenv'. */ typedef struct { - fexcept_t fpc; - void *ieee_instruction_pointer; + fexcept_t __fpc; + void *__ieee_instruction_pointer; /* failing instruction for ieee exceptions */ } fenv_t; diff --git a/libc/sysdeps/s390/fpu/fclrexcpt.c b/libc/sysdeps/s390/fpu/fclrexcpt.c index 2352d74b0..3e8d9bb3a 100644 --- a/libc/sysdeps/s390/fpu/fclrexcpt.c +++ b/libc/sysdeps/s390/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,3 +37,4 @@ feclearexcept (int excepts) /* Success. */ return 0; } +libm_hidden_def (feclearexcept) diff --git a/libc/sysdeps/s390/fpu/fegetenv.c b/libc/sysdeps/s390/fpu/fegetenv.c index 243f1f1e1..afbe2c771 100644 --- a/libc/sysdeps/s390/fpu/fegetenv.c +++ b/libc/sysdeps/s390/fpu/fegetenv.c @@ -1,5 +1,5 @@ /* Store current floating-point environment. - Copyright (C) 2000, 2008 Free Software Foundation, Inc. + Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). @@ -23,7 +23,7 @@ int fegetenv (fenv_t *envp) { - _FPU_GETCW (envp->fpc); + _FPU_GETCW (envp->__fpc); /* Success. */ return 0; diff --git a/libc/sysdeps/s390/fpu/feholdexcpt.c b/libc/sysdeps/s390/fpu/feholdexcpt.c index 76ca70fb4..5b97ade02 100644 --- a/libc/sysdeps/s390/fpu/feholdexcpt.c +++ b/libc/sysdeps/s390/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 2000, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). @@ -27,7 +27,7 @@ int feholdexcept (fenv_t *envp) fegetenv (envp); /* Clear the current sticky bits as more than one exception may be generated. */ - fpc = envp->fpc & ~(FPC_FLAGS_MASK | FPC_DXC_MASK); + fpc = envp->__fpc & ~(FPC_FLAGS_MASK | FPC_DXC_MASK); /* Hold from generating fpu exceptions temporarily. */ _FPU_SETCW ((fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT))); return 0; diff --git a/libc/sysdeps/s390/fpu/fesetenv.c b/libc/sysdeps/s390/fpu/fesetenv.c index 4fe82999d..b5342051f 100644 --- a/libc/sysdeps/s390/fpu/fesetenv.c +++ b/libc/sysdeps/s390/fpu/fesetenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment. - Copyright (C) 2000, 2008 Free Software Foundation, Inc. + Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). @@ -31,18 +31,18 @@ fesetenv (const fenv_t *envp) if (envp == FE_DFL_ENV) { - env.fpc = _FPU_DEFAULT; - env.ieee_instruction_pointer = 0; + env.__fpc = _FPU_DEFAULT; + env.__ieee_instruction_pointer = 0; } else if (envp == FE_NOMASK_ENV) { - env.fpc = FPC_EXCEPTION_MASK; - env.ieee_instruction_pointer = 0; + env.__fpc = FPC_EXCEPTION_MASK; + env.__ieee_instruction_pointer = 0; } else env = (*envp); - _FPU_SETCW (env.fpc); + _FPU_SETCW (env.__fpc); /* Success. */ return 0; diff --git a/libc/sysdeps/sh/sh4/fpu/bits/fenv.h b/libc/sysdeps/sh/sh4/fpu/bits/fenv.h index 93159499d..a29edfc1f 100644 --- a/libc/sysdeps/sh/sh4/fpu/bits/fenv.h +++ b/libc/sysdeps/sh/sh4/fpu/bits/fenv.h @@ -24,16 +24,21 @@ of the appropriate bits in the FPU control word. */ enum { - FE_INEXACT = 0x04, -#define FE_INEXACT FE_INEXACT - FE_UNDERFLOW = 0x08, -#define FE_UNDERFLOW FE_UNDERFLOW - FE_OVERFLOW = 0x10, -#define FE_OVERFLOW FE_OVERFLOW - FE_DIVBYZERO = 0x20, -#define FE_DIVBYZERO FE_DIVBYZERO - FE_INVALID = 0x40, -#define FE_INVALID FE_INVALID + FE_INEXACT = +#define FE_INEXACT 0x04 + FE_INEXACT, + FE_UNDERFLOW = +#define FE_UNDERFLOW 0x08 + FE_UNDERFLOW, + FE_OVERFLOW = +#define FE_OVERFLOW 0x10 + FE_OVERFLOW, + FE_DIVBYZERO = +#define FE_DIVBYZERO 0x20 + FE_DIVBYZERO, + FE_INVALID = +#define FE_INVALID 0x40 + FE_INVALID, }; #define FE_ALL_EXCEPT \ @@ -46,10 +51,12 @@ enum { __FE_UNDEFINED = -1, - FE_TONEAREST = 0x0, -#define FE_TONEAREST FE_TONEAREST - FE_TOWARDZERO = 0x1, -#define FE_TOWARDZERO FE_TOWARDZERO + FE_TONEAREST = +#define FE_TONEAREST 0x0 + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO 0x1 + FE_TOWARDZERO, }; @@ -66,4 +73,4 @@ typedef struct fenv_t; /* If the default argument is used we use this value. */ -#define FE_DFL_ENV ((fenv_t *) -1) +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/libc/sysdeps/sh/sh4/fpu/fclrexcpt.c b/libc/sysdeps/sh/sh4/fpu/fclrexcpt.c index b4b2ead02..2d31fa651 100644 --- a/libc/sysdeps/sh/sh4/fpu/fclrexcpt.c +++ b/libc/sysdeps/sh/sh4/fpu/fclrexcpt.c @@ -39,3 +39,4 @@ feclearexcept (int excepts) return 0; } +libm_hidden_def (feclearexcept) diff --git a/libc/sysdeps/sh/tininess.h b/libc/sysdeps/sh/tininess.h new file mode 100644 index 000000000..1db37790f --- /dev/null +++ b/libc/sysdeps/sh/tininess.h @@ -0,0 +1 @@ +#define TININESS_AFTER_ROUNDING 1 diff --git a/libc/sysdeps/sparc/fpu/bits/fenv.h b/libc/sysdeps/sparc/fpu/bits/fenv.h index 0e2a9b9e6..afe66ce5a 100644 --- a/libc/sysdeps/sparc/fpu/bits/fenv.h +++ b/libc/sysdeps/sparc/fpu/bits/fenv.h @@ -26,16 +26,21 @@ of the appropriate accrued exception bits from the FSR. */ enum { - FE_INVALID = (1 << 9), -#define FE_INVALID FE_INVALID - FE_OVERFLOW = (1 << 8), -#define FE_OVERFLOW FE_OVERFLOW - FE_UNDERFLOW = (1 << 7), -#define FE_UNDERFLOW FE_UNDERFLOW - FE_DIVBYZERO = (1 << 6), -#define FE_DIVBYZERO FE_DIVBYZERO - FE_INEXACT = (1 << 5) -#define FE_INEXACT FE_INEXACT + FE_INVALID = +#define FE_INVALID (1 << 9) + FE_INVALID, + FE_OVERFLOW = +#define FE_OVERFLOW (1 << 8) + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW (1 << 7) + FE_UNDERFLOW, + FE_DIVBYZERO = +#define FE_DIVBYZERO (1 << 6) + FE_DIVBYZERO, + FE_INEXACT = +#define FE_INEXACT (1 << 5) + FE_INEXACT }; #define FE_ALL_EXCEPT \ @@ -46,14 +51,18 @@ enum for the appropriate macros. */ enum { - FE_TONEAREST = (0U << 30), -#define FE_TONEAREST FE_TONEAREST - FE_TOWARDZERO = (1U << 30), -#define FE_TOWARDZERO FE_TOWARDZERO - FE_UPWARD = (2U << 30), -#define FE_UPWARD FE_UPWARD - FE_DOWNWARD = (3U << 30) -#define FE_DOWNWARD FE_DOWNWARD + FE_TONEAREST = +#define FE_TONEAREST (0 << 30) + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO (1 << 30) + FE_TOWARDZERO, + FE_UPWARD = +#define FE_UPWARD (-0x7fffffff - 1) /* (2 << 30) */ + FE_UPWARD, + FE_DOWNWARD = +#define FE_DOWNWARD (-0x40000000) /* (3 << 30) */ + FE_DOWNWARD }; #define __FE_ROUND_MASK (3U << 30) diff --git a/libc/sysdeps/sparc/fpu/fclrexcpt.c b/libc/sysdeps/sparc/fpu/fclrexcpt.c index 82b6ac4e2..50ec4f4ff 100644 --- a/libc/sysdeps/sparc/fpu/fclrexcpt.c +++ b/libc/sysdeps/sparc/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,4 +39,5 @@ strong_alias (__feclearexcept, __old_feclearexcept) compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1); #endif +libm_hidden_ver (__feclearexcept, feclearexcept) versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2); diff --git a/libc/sysdeps/sparc/fpu/fenv_private.h b/libc/sysdeps/sparc/fpu/fenv_private.h index a6e8e95a5..8690879dd 100644 --- a/libc/sysdeps/sparc/fpu/fenv_private.h +++ b/libc/sysdeps/sparc/fpu/fenv_private.h @@ -13,6 +13,15 @@ libc_feholdexcept (fenv_t *e) __fenv_ldfsr(etmp); } +static __always_inline void +libc_fesetround (int r) +{ + fenv_t etmp; + __fenv_stfsr(etmp); + etmp = (etmp & ~__FE_ROUND_MASK) | (r); + __fenv_ldfsr(etmp); +} + static __always_inline void libc_feholdexcept_setround (fenv_t *e, int r) { @@ -79,6 +88,7 @@ libc_feresetround (fenv_t *e) } #define libc_feholdexceptf libc_feholdexcept +#define libc_fesetroundf libc_fesetround #define libc_feholdexcept_setroundf libc_feholdexcept_setround #define libc_fetestexceptf libc_fetestexcept #define libc_fesetenvf libc_fesetenv @@ -87,6 +97,7 @@ libc_feresetround (fenv_t *e) #define libc_feholdsetroundf libc_feholdsetround #define libc_feresetroundf libc_feresetround #define libc_feholdexcept libc_feholdexcept +#define libc_fesetround libc_fesetround #define libc_feholdexcept_setround libc_feholdexcept_setround #define libc_fetestexcept libc_fetestexcept #define libc_fesetenv libc_fesetenv @@ -95,6 +106,7 @@ libc_feresetround (fenv_t *e) #define libc_feholdsetround libc_feholdsetround #define libc_feresetround libc_feresetround #define libc_feholdexceptl libc_feholdexcept +#define libc_fesetroundl libc_fesetround #define libc_feholdexcept_setroundl libc_feholdexcept_setround #define libc_fetestexceptl libc_fetestexcept #define libc_fesetenvl libc_fesetenv diff --git a/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/ifunc-impl-list.c b/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/ifunc-impl-list.c new file mode 100644 index 000000000..a04aa0f67 --- /dev/null +++ b/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/ifunc-impl-list.c @@ -0,0 +1 @@ +#include diff --git a/libc/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c b/libc/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c new file mode 100644 index 000000000..65a8a9ae8 --- /dev/null +++ b/libc/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c @@ -0,0 +1,75 @@ +/* Enumerate available IFUNC implementations of a function. sparc version. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include + +/* Fill ARRAY of MAX elements with IFUNC implementations for function + NAME and return the number of valid entries. */ + +size_t +__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, + size_t max) +{ + size_t i = 0; + int hwcap; + + hwcap = GLRO(dl_hwcap); + + IFUNC_IMPL (i, name, memcpy, + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_SPARC_CRYPTO, + __memcpy_niagara4) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_SPARC_N2, + __memcpy_niagara2) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_SPARC_BLKINIT, + __memcpy_niagara1) + IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_SPARC_ULTRA3, + __memcpy_ultra3) + IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ultra1)); + + IFUNC_IMPL (i, name, mempcpy, + IFUNC_IMPL_ADD (array, i, mempcpy, hwcap & HWCAP_SPARC_CRYPTO, + __mempcpy_niagara4) + IFUNC_IMPL_ADD (array, i, mempcpy, hwcap & HWCAP_SPARC_N2, + __mempcpy_niagara2) + IFUNC_IMPL_ADD (array, i, mempcpy, hwcap & HWCAP_SPARC_BLKINIT, + __mempcpy_niagara1) + IFUNC_IMPL_ADD (array, i, mempcpy, hwcap & HWCAP_SPARC_ULTRA3, + __mempcpy_ultra3) + IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ultra1)); + + IFUNC_IMPL (i, name, bzero, + IFUNC_IMPL_ADD (array, i, bzero, hwcap & HWCAP_SPARC_CRYPTO, + __bzero_niagara4) + IFUNC_IMPL_ADD (array, i, bzero, hwcap & HWCAP_SPARC_BLKINIT, + __bzero_niagara1) + IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ultra1)); + + IFUNC_IMPL (i, name, memset, + IFUNC_IMPL_ADD (array, i, memset, hwcap & HWCAP_SPARC_CRYPTO, + __memset_niagara4) + IFUNC_IMPL_ADD (array, i, memset, hwcap & HWCAP_SPARC_BLKINIT, + __memset_niagara1) + IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ultra1)); + + return i; +} diff --git a/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S b/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S index 50a40883c..51cb88c39 100644 --- a/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S +++ b/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S @@ -1,4 +1,5 @@ /* Multiple versions of memcpy + All versions must be listed in ifunc-impl-list.c. Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by David S. Miller (davem@davemloft.net) This file is part of the GNU C Library. diff --git a/libc/sysdeps/sparc/sparc64/multiarch/memset.S b/libc/sysdeps/sparc/sparc64/multiarch/memset.S index 8b3faee91..3a637c707 100644 --- a/libc/sysdeps/sparc/sparc64/multiarch/memset.S +++ b/libc/sysdeps/sparc/sparc64/multiarch/memset.S @@ -1,4 +1,5 @@ /* Multiple versions of memset and bzero + All versions must be listed in ifunc-impl-list.c. Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by David S. Miller (davem@davemloft.net) This file is part of the GNU C Library. diff --git a/libc/sysdeps/unix/Makefile b/libc/sysdeps/unix/Makefile index dda3a3ee0..c5eb87e4f 100644 --- a/libc/sysdeps/unix/Makefile +++ b/libc/sysdeps/unix/Makefile @@ -64,7 +64,6 @@ $(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \ echo "stub_warning ($$call)"; \ echo "weak_alias (_no_syscall, __GI_$$call)" ;; \ esac; \ - echo '#include '; \ done) > $@T mv -f $@T $@ generated += stub-syscalls.c diff --git a/libc/sysdeps/unix/bsd/getpt.c b/libc/sysdeps/unix/bsd/getpt.c index 2c566cbd4..5573bab01 100644 --- a/libc/sysdeps/unix/bsd/getpt.c +++ b/libc/sysdeps/unix/bsd/getpt.c @@ -88,5 +88,4 @@ __posix_openpt (int oflag) weak_alias (__posix_openpt, posix_openpt) stub_warning (posix_openpt) -# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/epoll_pwait.c b/libc/sysdeps/unix/sysv/linux/epoll_pwait.c index 70756e844..7bea455b4 100644 --- a/libc/sysdeps/unix/sysv/linux/epoll_pwait.c +++ b/libc/sysdeps/unix/sysv/linux/epoll_pwait.c @@ -64,7 +64,6 @@ int epoll_pwait (int epfd, struct epoll_event *events, } stub_warning (epoll_pwait) -# include #endif libc_hidden_def (epoll_pwait) diff --git a/libc/sysdeps/unix/sysv/linux/futimens.c b/libc/sysdeps/unix/sysv/linux/futimens.c index f586b80f3..c4469fc93 100644 --- a/libc/sysdeps/unix/sysv/linux/futimens.c +++ b/libc/sysdeps/unix/sysv/linux/futimens.c @@ -45,5 +45,4 @@ futimens (int fd, const struct timespec tsp[2]) } #ifndef __NR_utimensat stub_warning (futimens) -# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/lutimes.c b/libc/sysdeps/unix/sysv/linux/lutimes.c index c26623262..7e05a72a2 100644 --- a/libc/sysdeps/unix/sysv/linux/lutimes.c +++ b/libc/sysdeps/unix/sysv/linux/lutimes.c @@ -54,5 +54,4 @@ lutimes (const char *file, const struct timeval tvp[2]) #ifndef __NR_utimensat stub_warning (lutimes) -# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/paths.h b/libc/sysdeps/unix/sysv/linux/paths.h index f4860f24d..1342ab3a9 100644 --- a/libc/sysdeps/unix/sysv/linux/paths.h +++ b/libc/sysdeps/unix/sysv/linux/paths.h @@ -61,9 +61,9 @@ #define _PATH_SHELLS "/etc/shells" #define _PATH_TTY "/dev/tty" #define _PATH_UNIX "/boot/vmlinux" -#define _PATH_UTMP "/var/run/utmp" +#define _PATH_UTMP "/var/run/utmp" #define _PATH_VI "/usr/bin/vi" -#define _PATH_WTMP "/var/log/wtmp" +#define _PATH_WTMP "/var/log/wtmp" /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist index a3cd89540..8e4595825 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist @@ -1774,13 +1774,13 @@ GLIBC_2.16 timespec_get F GLIBC_2.17 GLIBC_2.17 A + __ppc_get_timebase_freq F clock_getcpuclockid F clock_getres F clock_gettime F clock_nanosleep F clock_settime F secure_getenv F - __ppc_get_timebase_freq F GLIBC_2.2 GLIBC_2.2 A _IO_adjust_wcolumn F diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S index ded2a35e0..0939a6539 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S @@ -134,26 +134,26 @@ L(noparms): 'makecontext' call. If the pointer is NULL the process must terminate. */ L(exitcode): - /* Recover the ucontext and TOC from the dummy frame. */ - ld r1,FRAME_BACKCHAIN(r1) /* Unstack the parameter save area frame. */ - ld r3,FRAME_PARM1_SAVE(r1) - ld r2,FRAME_TOC_SAVE(r1) - ld r3,UCONTEXT_LINK(r3) /* Load the resume context. */ - cmpdi r3,0 - beq L(BADSTATUS) + /* Recover the ucontext and TOC from the dummy frame. */ + ld r1,FRAME_BACKCHAIN(r1) /* Unstack the parameter save area frame. */ + ld r3,FRAME_PARM1_SAVE(r1) + ld r2,FRAME_TOC_SAVE(r1) + ld r3,UCONTEXT_LINK(r3) /* Load the resume context. */ + cmpdi r3,0 + beq L(do_exit) bl JUMPTARGET(__setcontext) nop - -L(BADSTATUS): -/* If setcontext returns (which can happen if the syscall fails) we will - exit the program with error status (-1). */ - li r3,-1 + /* If setcontext returns (which can happen if the syscall fails) we will + exit the program with error status (-1). */ + li r3,-1 +L(do_exit): #ifdef SHARED - b JUMPTARGET(__GI_exit); + b JUMPTARGET(__GI_exit); #else - b JUMPTARGET(exit); - nop + b JUMPTARGET(exit); + nop #endif + b L(do_exit) /* The address of the exit code is in the link register. Store the lr in the ucontext as LNK so the target function will return to our diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist index 0a80d0c57..8eaaccdfc 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist @@ -80,13 +80,13 @@ GLIBC_2.16 timespec_get F GLIBC_2.17 GLIBC_2.17 A + __ppc_get_timebase_freq F clock_getcpuclockid F clock_getres F clock_gettime F clock_nanosleep F clock_settime F secure_getenv F - __ppc_get_timebase_freq F GLIBC_2.3 GLIBC_2.3 A _Exit F diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c index f17a4949f..f4a49c5c4 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c @@ -48,6 +48,4 @@ sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) return -1; } stub_warning (sync_file_range) - -# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/readahead.c b/libc/sysdeps/unix/sysv/linux/readahead.c index e7d0c110e..439936741 100644 --- a/libc/sysdeps/unix/sysv/linux/readahead.c +++ b/libc/sysdeps/unix/sysv/linux/readahead.c @@ -42,8 +42,6 @@ __readahead (int fd, off64_t offset, size_t count) return -1; } stub_warning (readahead) - -# include #endif weak_alias (__readahead, readahead) diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h index 43eee7a37..5b95878cc 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h +++ b/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h @@ -25,8 +25,6 @@ #if __WORDSIZE == 64 /* Not necessary, files are always with 64bit off_t. */ # define __O_LARGEFILE 0 -#else -# define __O_LARGEFILE 0100000 #endif #if __WORDSIZE == 64 diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c index 67ff77fa8..cb31e5ca2 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c @@ -91,11 +91,9 @@ __get_clockfreq_via_proc_openprom (void) { unsigned long int buf[4096 / sizeof (unsigned long int)]; struct dirent *dirp = (struct dirent *) buf; - off_t dbase = (off_t) 0; ssize_t len; - while ((len = __getdirentries (obp_fd, (char *) dirp, - sizeof (buf), &dbase)) > 0) + while ((len = __getdents (obp_fd, (char *) dirp, sizeof (buf))) > 0) { struct dirent *this_dirp = dirp; @@ -131,7 +129,7 @@ __get_clockfreq_via_proc_openprom (void) if (read (clkfreq_fd, type_string, sizeof (type_string)) > 0) result = (hp_timing_t) - strtoull (type_string, NULL, 16); + strtoumax (type_string, NULL, 16); close (clkfreq_fd); } } diff --git a/libc/sysdeps/unix/sysv/linux/sync_file_range.c b/libc/sysdeps/unix/sysv/linux/sync_file_range.c index a7785298b..551e900da 100644 --- a/libc/sysdeps/unix/sysv/linux/sync_file_range.c +++ b/libc/sysdeps/unix/sysv/linux/sync_file_range.c @@ -74,6 +74,4 @@ sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) return -1; } stub_warning (sync_file_range) - -# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/utimensat.c b/libc/sysdeps/unix/sysv/linux/utimensat.c index f52e615dd..fc1d362ce 100644 --- a/libc/sysdeps/unix/sysv/linux/utimensat.c +++ b/libc/sysdeps/unix/sysv/linux/utimensat.c @@ -45,5 +45,4 @@ utimensat (int fd, const char *file, const struct timespec tsp[2], } #ifndef __NR_utimensat stub_warning (utimensat) -# include #endif diff --git a/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h b/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h index 9251e750e..2bcded5bf 100644 --- a/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h +++ b/libc/sysdeps/unix/sysv/linux/x86/bits/fcntl.h @@ -22,8 +22,6 @@ #ifdef __x86_64__ # define __O_LARGEFILE 0 -#else -# define __O_LARGEFILE 0100000 #endif #ifdef __x86_64__ diff --git a/libc/sysdeps/x86/Makefile b/libc/sysdeps/x86/Makefile new file mode 100644 index 000000000..f25d1e241 --- /dev/null +++ b/libc/sysdeps/x86/Makefile @@ -0,0 +1,4 @@ +ifeq ($(subdir),elf) +CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\ + -mno-sse -mno-mmx) +endif diff --git a/libc/sysdeps/x86/fpu/bits/fenv.h b/libc/sysdeps/x86/fpu/bits/fenv.h index b2c01c403..e0079cd97 100644 --- a/libc/sysdeps/x86/fpu/bits/fenv.h +++ b/libc/sysdeps/x86/fpu/bits/fenv.h @@ -23,17 +23,22 @@ of the appropriate bits in the FPU control word. */ enum { - FE_INVALID = 0x01, -#define FE_INVALID FE_INVALID + FE_INVALID = +#define FE_INVALID 0x01 + FE_INVALID, __FE_DENORM = 0x02, - FE_DIVBYZERO = 0x04, -#define FE_DIVBYZERO FE_DIVBYZERO - FE_OVERFLOW = 0x08, -#define FE_OVERFLOW FE_OVERFLOW - FE_UNDERFLOW = 0x10, -#define FE_UNDERFLOW FE_UNDERFLOW - FE_INEXACT = 0x20 -#define FE_INEXACT FE_INEXACT + FE_DIVBYZERO = +#define FE_DIVBYZERO 0x04 + FE_DIVBYZERO, + FE_OVERFLOW = +#define FE_OVERFLOW 0x08 + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW 0x10 + FE_UNDERFLOW, + FE_INEXACT = +#define FE_INEXACT 0x20 + FE_INEXACT }; #define FE_ALL_EXCEPT \ @@ -44,14 +49,18 @@ enum for the appropriate macros. */ enum { - FE_TONEAREST = 0, -#define FE_TONEAREST FE_TONEAREST - FE_DOWNWARD = 0x400, -#define FE_DOWNWARD FE_DOWNWARD - FE_UPWARD = 0x800, -#define FE_UPWARD FE_UPWARD - FE_TOWARDZERO = 0xc00 -#define FE_TOWARDZERO FE_TOWARDZERO + FE_TONEAREST = +#define FE_TONEAREST 0 + FE_TONEAREST, + FE_DOWNWARD = +#define FE_DOWNWARD 0x400 + FE_DOWNWARD, + FE_UPWARD = +#define FE_UPWARD 0x800 + FE_UPWARD, + FE_TOWARDZERO = +#define FE_TOWARDZERO 0xc00 + FE_TOWARDZERO }; diff --git a/libc/sysdeps/x86/tininess.h b/libc/sysdeps/x86/tininess.h new file mode 100644 index 000000000..1db37790f --- /dev/null +++ b/libc/sysdeps/x86/tininess.h @@ -0,0 +1 @@ +#define TININESS_AFTER_ROUNDING 1 diff --git a/libc/sysdeps/x86_64/fpu/fclrexcpt.c b/libc/sysdeps/x86_64/fpu/fclrexcpt.c index 5ef316212..2d4031339 100644 --- a/libc/sysdeps/x86_64/fpu/fclrexcpt.c +++ b/libc/sysdeps/x86_64/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -49,3 +49,4 @@ feclearexcept (int excepts) /* Success. */ return 0; } +libm_hidden_def (feclearexcept) diff --git a/libc/sysdeps/x86_64/multiarch/strcasestr-nonascii.c b/libc/sysdeps/x86_64/multiarch/strcasestr-nonascii.c index a1f996884..db84a43ac 100644 --- a/libc/sysdeps/x86_64/multiarch/strcasestr-nonascii.c +++ b/libc/sysdeps/x86_64/multiarch/strcasestr-nonascii.c @@ -16,7 +16,8 @@ License along with the GNU C Library; if not, see . */ -# include +#include +#include /* Similar to __m128i_strloadu. Convert to lower case for none-POSIX/C -- cgit v1.2.3