diff options
| author | Joseph Myers <joseph@codesourcery.com> | 2013-10-18 21:03:40 +0000 |
|---|---|---|
| committer | Joseph Myers <joseph@codesourcery.com> | 2013-10-18 21:04:22 +0000 |
| commit | 3c8325fb47c3688cc7d9b70ada2ec71fb0eb219a (patch) | |
| tree | eb315c426bd9c1f5aa42f40f6e9e74f2d7aabcd3 | |
| parent | 289528850de3c197821e0b670b23980ff8b4d538 (diff) | |
| download | glibc-3c8325fb47c3688cc7d9b70ada2ec71fb0eb219a.tar.xz glibc-3c8325fb47c3688cc7d9b70ada2ec71fb0eb219a.zip | |
Add e500 port.
32 files changed, 1227 insertions, 11 deletions
@@ -1,3 +1,61 @@ +2013-10-18 Joseph Myers <joseph@codesourcery.com> + Aldy Hernandez <aldyh@redhat.com> + + * sysdeps/powerpc/powerpc32/e500/nofpu/Makefile: New file. + * sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_prctl.c: + Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_from_spe.c: + Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_prctl.c: + Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fexcepts_to_spe.c: + Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fgetexcptflg.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcept-soft.c: + Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fsetexcptflg.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/ftestexcept.c: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/get-rounding-mode.h: + Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S: Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/spe-raise.c: Likewise. + * sysdeps/powerpc/preconfigure: Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies: + Likewise. + * sysdeps/powerpc/nofpu/soft-supp.h [__NO_FPRS__ && !_SOFT_FLOAT]: + Replace contents of file by #include of <fenv_libc.h>. + * sysdeps/powerpc/soft-fp/sfp-machine.h + [__NO_FPRS__ && !_SOFT_FLOAT]: Include <fenv_libc.h>, <sysdep.h> + and <sys/prctl.h>. + [__NO_FPRS__ && !_SOFT_FLOAT] (__feraiseexcept_soft): Declare. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_INEXACT): Define macro. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_INVALID): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_DIVZERO): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_UNDERFLOW): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_EX_OVERFLOW): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (_FP_DECL_EX): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_INIT_ROUNDMODE): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_INIT_EXCEPTIONS): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_HANDLE_EXCEPTIONS): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_ROUNDMODE): Likewise. + [__NO_FPRS__ && !_SOFT_FLOAT] (FP_TRAPPING_EXCEPTIONS): Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/localplt.data: + Allow copysignl PLT reference to be missing. + 2013-10-18 Richard Sandiford <richard@codesourcery.com> Joseph Myers <joseph@codesourcery.com diff --git a/sysdeps/powerpc/nofpu/soft-supp.h b/sysdeps/powerpc/nofpu/soft-supp.h index 64a3d2a1d2..18b4550e3b 100644 --- a/sysdeps/powerpc/nofpu/soft-supp.h +++ b/sysdeps/powerpc/nofpu/soft-supp.h @@ -17,7 +17,13 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ -#include <fenv.h> +#if defined __NO_FPRS__ && !defined _SOFT_FLOAT + +# include <fenv_libc.h> + +#else + +# include <fenv.h> typedef union { @@ -25,6 +31,7 @@ typedef union unsigned int l[2]; } fenv_union_t; +#endif /* FIXME: these variables should be thread specific (see bugzilla bug 15483) and ideally preserved across signal handlers, like hardware diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile b/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile new file mode 100644 index 0000000000..adf556870a --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/Makefile @@ -0,0 +1,9 @@ +ifeq ($(subdir),math) +libm-routines += fexcepts_to_spe fexcepts_from_spe +libm-routines += fexcepts_to_prctl fexcepts_from_prctl +libm-routines += fe_note_change +endif + +ifeq ($(subdir),soft-fp) +sysdep_routines += fraiseexcept-soft +endif diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c new file mode 100644 index 0000000000..92a7dd1e09 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fclrexcpt.c @@ -0,0 +1,53 @@ +/* Clear given exceptions in current floating-point environment. e500 version. + Copyright (C) 2004-2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <fenv_libc.h> + +#undef feclearexcept +int +__feclearexcept (int excepts) +{ + unsigned int fpescr; + int excepts_spe = __fexcepts_to_spe (excepts); + + /* Get the current state. */ + fpescr = fegetenv_register (); + + /* Clear the relevant bits. */ + fpescr &= ~excepts_spe; + + /* Put the new state in effect. */ + fesetenv_register (fpescr); + + /* Let the kernel know if the "invalid" or "underflow" bit was + cleared. */ + if (excepts & (FE_INVALID | FE_UNDERFLOW)) + __fe_note_change (); + + /* Success. */ + return 0; +} + +#include <shlib-compat.h> +#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) +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/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c new file mode 100644 index 0000000000..43a5706264 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fe_note_change.c @@ -0,0 +1,39 @@ +/* Note a change to floating-point exceptions. + Copyright (C) 2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <fenv_libc.h> +#include <sysdep.h> +#include <sys/prctl.h> + +/* Inform the kernel of a change to floating-point exceptions. */ + +void +__fe_note_change (void) +{ + int pflags, r; + INTERNAL_SYSCALL_DECL (err); + + r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + return; + if ((pflags & PR_FP_EXC_SW_ENABLE) == 0) + INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, + pflags | PR_FP_EXC_SW_ENABLE); +} + +libm_hidden_def (__fe_note_change) diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c new file mode 100644 index 0000000000..7cc963c019 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fedisblxcpt.c @@ -0,0 +1,54 @@ +/* Disable floating-point exceptions. e500 version. + Copyright (C) 2004-2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <fenv_libc.h> +#include <sysdep.h> +#include <sys/prctl.h> + +int +fedisableexcept (int excepts) +{ + int result = 0, pflags, r; + INTERNAL_SYSCALL_DECL (err); + + r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + return -1; + + /* Save old enable bits. */ + result = __fexcepts_from_prctl (pflags); + + pflags &= ~__fexcepts_to_prctl (excepts); + r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, + pflags | PR_FP_EXC_SW_ENABLE); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + return -1; + + /* If disabling signals for "inexact", also disable trapping to the + kernel. */ + if ((excepts & FE_INEXACT) != 0) + { + unsigned long fpescr; + + fpescr = fegetenv_register (); + fpescr &= ~SPEFSCR_FINXE; + fesetenv_register (fpescr); + } + + return result; +} diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c b/sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c new file mode 100644 index 0000000000..133dde7b31 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/feenablxcpt.c @@ -0,0 +1,54 @@ +/* Enable floating-point exceptions. e500 version. + Copyright (C) 2004-2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <fenv_libc.h> +#include <sysdep.h> +#include <sys/prctl.h> + +int +feenableexcept (int excepts) +{ + unsigned int result = 0, pflags, r; + INTERNAL_SYSCALL_DECL (err); + + r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + return -1; + + /* Save old enable bits. */ + result = __fexcepts_from_prctl (pflags); + + pflags |= __fexcepts_to_prctl (excepts); + r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, + pflags | PR_FP_EXC_SW_ENABLE); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + return -1; + + /* If enabling signals for "inexact", also enable trapping to the + kernel. */ + if ((excepts & FE_INEXACT) != 0) + { + unsigned long fpescr; + + fpescr = fegetenv_register (); + fpescr |= SPEFSCR_FINXE; + fesetenv_register (fpescr); + } + + return result; +} diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c new file mode 100644 index 0000000000..bfcbca2ad3 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c @@ -0,0 +1,47 @@ +/* Store current floating-point environment. e500 version. + Copyright (C) 2004-2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <fenv_libc.h> +#include <sysdep.h> +#include <sys/prctl.h> + +int +__fegetenv (fenv_t *envp) +{ + fenv_union_t u; + INTERNAL_SYSCALL_DECL (err); + int r; + + r = INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + return -1; + + u.l[1] = fegetenv_register (); + *envp = u.fenv; + + /* Success. */ + return 0; +} + +#include <shlib-compat.h> +#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) +strong_alias (__fegetenv, __old_fegetenv) +compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1); +#endif + +versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2); diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c new file mode 100644 index 0000000000..9c7afc74f4 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetexcept.c @@ -0,0 +1,36 @@ +/* Get floating-point exceptions. e500 version. + Copyright (C) 2004-2013 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 + <http://www.gnu.org/licenses/>. */ + +#include <fenv_libc.h> +#include <sysdep.h> +#include <sys/prctl.h> + +int +fegetexcept (void) +{ + int result = 0, pflags, r; |
