glibc/sysdeps/arm/fsetexcptflg.c

46 lines
1.4 KiB
C
Raw Permalink Normal View History

2005-10-10 17:29:32 +02:00
/* Set floating-point environment exception handling.
Copyright (C) 1997-2022 Free Software Foundation, Inc.
2005-10-10 17:29:32 +02: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.
You should have received a copy of the GNU Lesser General Public
2012-03-10 00:56:38 +01:00
License along with the GNU C Library. If not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 07:40:42 +02:00
<https://www.gnu.org/licenses/>. */
2005-10-10 17:29:32 +02:00
#include <fenv.h>
#include <fpu_control.h>
#include <arm-features.h>
2005-10-10 17:29:32 +02: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 02:41:20 +02:00
fesetexceptflag (const fexcept_t *flagp, int excepts)
2005-10-10 17:29:32 +02:00
{
fpu_control_t fpscr, new_fpscr;
2005-10-10 17:29:32 +02:00
2014-05-15 16:18:40 +02:00
/* Fail if a VFP unit isn't present unless nothing needs to be done. */
if (!ARM_HAVE_VFP)
return (excepts != 0);
2005-10-10 17:29:32 +02:00
2014-05-15 16:18:40 +02:00
_FPU_GETCW (fpscr);
excepts &= FE_ALL_EXCEPT;
2005-10-10 17:29:32 +02:00
2014-05-15 16:18:40 +02:00
/* Set the desired exception mask. */
new_fpscr = fpscr & ~excepts;
new_fpscr |= *flagp & excepts;
/* Write new exception flags if changed. */
if (new_fpscr != fpscr)
_FPU_SETCW (new_fpscr);
2005-10-10 17:29:32 +02:00
2014-05-15 16:18:40 +02:00
return 0;
2005-10-10 17:29:32 +02:00
}