2005-10-10 15:29:32 +00:00
|
|
|
/* Install given floating-point environment.
|
2015-01-02 16:28:19 +00:00
|
|
|
Copyright (C) 2004-2015 Free Software Foundation, Inc.
|
2005-10-10 15:29:32 +00:00
|
|
|
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.
|
|
|
|
|
2011-03-21 15:40:37 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-03-09 23:56:38 +00:00
|
|
|
License along with the GNU C Library. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2005-10-10 15:29:32 +00:00
|
|
|
|
2014-05-19 08:08:59 +00:00
|
|
|
#include <fenv.h>
|
2014-06-26 20:35:31 +00:00
|
|
|
#include <fpu_control.h>
|
2012-08-09 17:04:56 +00:00
|
|
|
#include <arm-features.h>
|
2005-10-10 15:29:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
int
|
Clean up ARM old-ABI symbol versioning relics.
This patch cleans up some symbol versioning code in the ARM port that
exists only as relics of the old-ABI port, which was removed some time
ago.
The minimum symbol version in the ARM port is GLIBC_2.4 (the version
where the EABI port was introduced). Thus, any SHLIB_COMPAT
conditionals where the later version is 2.4 or later are obsolete and
can be removed. In addition, there is no need to set symbol versions
before 2.4 explicitly if the symbols would have a version of 2.4 by
default anyway. This includes most of the entries in
sysdeps/unix/sysv/linux/arm/Versions: those for GLIBC_2.0 are for
libgcc unwind functions that aren't actually in ARM EABI glibc at all,
while those for GLIBC_2.2 and GLIBC_2.3.3 are for functions which for
the old-ABI port may have had versions different from the
architecture-independent default, but where for EABI the default
suffices (both the default and the version in that file map to 2.4, so
the entries in that file do nothing). The GLIBC_2.1 entries are
needed (architecture-specific functions), but it seems less confusing
for those to say GLIBC_2.4, as the actual version those symbols in
fact have.
Various cases in the <fenv.h> functions where a function is defined as
__fe* with an fe* versioned alias are cleaned up just to define fe*
directly, as done e.g. on AArch64. If in future we actually need an
__fe* name for use from C90 functions in libm as discussed recently,
of course we can add one on all architectures and make the fe* name
into a weak alias for that particular function, but for now the __fe*
names aren't needed.
In the case of posix_fadvise64, the __posix_fadvise64_l64 name and
posix_fadvise64 alias are kept as __posix_fadvise64_l64 is used in
posix_fadvise. (For that to be a namespace-clean use, posix_fadvise64
needs to be a *weak* alias not a strong one as at present, but that's
an independent preexisting bug.)
(There remain references to GLIBC_2_2 in
sysdeps/unix/sysv/linux/arm/{msgctl.c,semctl.c,shmctl.c}. As those
files are used by alpha which has a genuine 2.2 version for those
functions, I think those references need to stay as-is.)
Tested that the disassembly of installed shared libraries is unchanged
by this patch (though function names shown in disassembly change to no
longer have @@GLIBC_2.4, now those functions get versioned only by the
version map and not redundantly at assembler time) and that the ABI
tests pass.
* sysdeps/arm/fclrexcpt.c (__feclearexcept): Rename to
feclearexcept. Remove symbol versioning code.
* sysdeps/arm/fegetenv.c (__fegetenv): Rename to fegetenv. Remove
symbol versioning code.
* sysdeps/arm/fesetenv.c (__fesetenv): Rename to fesetenv. Remove
symbol versioning code.
* sysdeps/arm/feupdateenv.c (__feupdateenv): Rename to
feupdateenv. Remove symbol versioning code.
* sysdeps/arm/fgetexcptflg.c (__fegetexceptflag): Rename to
fegetexceptflag. Remove symbol versioning code.
* sysdeps/arm/fsetexcptflg.c (__fesetexceptflag): Rename to
fesetexceptflag. Remove symbol versioning code.
* sysdeps/unix/sysv/linux/arm/Versions (libc): Remove GLIBC_2.0,
GLIBC_2.2 and GLIBC_2.3.3 entries. Change GLIBC_2.1 to GLIBC_2.4.
* sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
(__posix_fadvise64_l32): Remove prototype.
[SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)]: Remove conditional
code.
2014-05-14 00:41:20 +00:00
|
|
|
fesetenv (const fenv_t *envp)
|
2005-10-10 15:29:32 +00:00
|
|
|
{
|
2014-06-24 15:05:23 +00:00
|
|
|
fpu_control_t fpscr, new_fpscr, updated_fpscr;
|
2014-05-19 08:08:59 +00:00
|
|
|
|
2014-05-15 14:18:40 +00:00
|
|
|
/* Fail if a VFP unit isn't present. */
|
|
|
|
if (!ARM_HAVE_VFP)
|
|
|
|
return 1;
|
|
|
|
|
2014-05-19 08:08:59 +00:00
|
|
|
_FPU_GETCW (fpscr);
|
2014-05-15 14:18:40 +00:00
|
|
|
|
2014-06-24 15:05:23 +00:00
|
|
|
if ((envp != FE_DFL_ENV) && (envp != FE_NOMASK_ENV))
|
|
|
|
{
|
|
|
|
/* The new FPSCR is valid, so don't merge the reserved flags. */
|
|
|
|
new_fpscr = envp->__cw;
|
2014-05-15 14:18:40 +00:00
|
|
|
|
2014-06-24 15:05:23 +00:00
|
|
|
/* Write new FPSCR if different (ignoring NZCV flags). */
|
|
|
|
if (((fpscr ^ new_fpscr) & ~_FPU_MASK_NZCV) != 0)
|
|
|
|
_FPU_SETCW (new_fpscr);
|
2014-05-15 14:18:40 +00:00
|
|
|
|
2014-06-24 15:05:23 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-05-15 14:18:40 +00:00
|
|
|
|
2014-06-24 15:05:23 +00:00
|
|
|
/* Preserve the reserved FPSCR flags. */
|
|
|
|
new_fpscr = fpscr & _FPU_RESERVED;
|
|
|
|
new_fpscr |= (envp == FE_DFL_ENV) ? _FPU_DEFAULT : _FPU_IEEE;
|
|
|
|
|
|
|
|
if (((new_fpscr ^ fpscr) & ~_FPU_MASK_NZCV) != 0)
|
2014-05-19 08:08:59 +00:00
|
|
|
{
|
2014-06-24 15:05:23 +00:00
|
|
|
_FPU_SETCW (new_fpscr);
|
|
|
|
|
2014-05-19 08:08:59 +00:00
|
|
|
/* Not all VFP architectures support trapping exceptions, so
|
|
|
|
test whether the relevant bits were set and fail if not. */
|
2014-06-24 15:05:23 +00:00
|
|
|
_FPU_GETCW (updated_fpscr);
|
|
|
|
|
|
|
|
return new_fpscr & ~updated_fpscr;
|
2005-10-10 15:29:32 +00:00
|
|
|
}
|
|
|
|
|
2014-05-15 14:18:40 +00:00
|
|
|
return 0;
|
2005-10-10 15:29:32 +00:00
|
|
|
}
|
Clean up ARM old-ABI symbol versioning relics.
This patch cleans up some symbol versioning code in the ARM port that
exists only as relics of the old-ABI port, which was removed some time
ago.
The minimum symbol version in the ARM port is GLIBC_2.4 (the version
where the EABI port was introduced). Thus, any SHLIB_COMPAT
conditionals where the later version is 2.4 or later are obsolete and
can be removed. In addition, there is no need to set symbol versions
before 2.4 explicitly if the symbols would have a version of 2.4 by
default anyway. This includes most of the entries in
sysdeps/unix/sysv/linux/arm/Versions: those for GLIBC_2.0 are for
libgcc unwind functions that aren't actually in ARM EABI glibc at all,
while those for GLIBC_2.2 and GLIBC_2.3.3 are for functions which for
the old-ABI port may have had versions different from the
architecture-independent default, but where for EABI the default
suffices (both the default and the version in that file map to 2.4, so
the entries in that file do nothing). The GLIBC_2.1 entries are
needed (architecture-specific functions), but it seems less confusing
for those to say GLIBC_2.4, as the actual version those symbols in
fact have.
Various cases in the <fenv.h> functions where a function is defined as
__fe* with an fe* versioned alias are cleaned up just to define fe*
directly, as done e.g. on AArch64. If in future we actually need an
__fe* name for use from C90 functions in libm as discussed recently,
of course we can add one on all architectures and make the fe* name
into a weak alias for that particular function, but for now the __fe*
names aren't needed.
In the case of posix_fadvise64, the __posix_fadvise64_l64 name and
posix_fadvise64 alias are kept as __posix_fadvise64_l64 is used in
posix_fadvise. (For that to be a namespace-clean use, posix_fadvise64
needs to be a *weak* alias not a strong one as at present, but that's
an independent preexisting bug.)
(There remain references to GLIBC_2_2 in
sysdeps/unix/sysv/linux/arm/{msgctl.c,semctl.c,shmctl.c}. As those
files are used by alpha which has a genuine 2.2 version for those
functions, I think those references need to stay as-is.)
Tested that the disassembly of installed shared libraries is unchanged
by this patch (though function names shown in disassembly change to no
longer have @@GLIBC_2.4, now those functions get versioned only by the
version map and not redundantly at assembler time) and that the ABI
tests pass.
* sysdeps/arm/fclrexcpt.c (__feclearexcept): Rename to
feclearexcept. Remove symbol versioning code.
* sysdeps/arm/fegetenv.c (__fegetenv): Rename to fegetenv. Remove
symbol versioning code.
* sysdeps/arm/fesetenv.c (__fesetenv): Rename to fesetenv. Remove
symbol versioning code.
* sysdeps/arm/feupdateenv.c (__feupdateenv): Rename to
feupdateenv. Remove symbol versioning code.
* sysdeps/arm/fgetexcptflg.c (__fegetexceptflag): Rename to
fegetexceptflag. Remove symbol versioning code.
* sysdeps/arm/fsetexcptflg.c (__fesetexceptflag): Rename to
fesetexceptflag. Remove symbol versioning code.
* sysdeps/unix/sysv/linux/arm/Versions (libc): Remove GLIBC_2.0,
GLIBC_2.2 and GLIBC_2.3.3 entries. Change GLIBC_2.1 to GLIBC_2.4.
* sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
(__posix_fadvise64_l32): Remove prototype.
[SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)]: Remove conditional
code.
2014-05-14 00:41:20 +00:00
|
|
|
libm_hidden_def (fesetenv)
|