diff options
Diffstat (limited to 'libatomic')
-rw-r--r-- | libatomic/ChangeLog | 10 | ||||
-rw-r--r-- | libatomic/Makefile.am | 3 | ||||
-rw-r--r-- | libatomic/Makefile.in | 9 | ||||
-rw-r--r-- | libatomic/auto-config.h.in | 3 | ||||
-rwxr-xr-x | libatomic/configure | 105 | ||||
-rw-r--r-- | libatomic/configure.ac | 3 | ||||
-rw-r--r-- | libatomic/fenv.c | 72 | ||||
-rw-r--r-- | libatomic/libatomic.map | 4 |
8 files changed, 201 insertions, 8 deletions
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index 425ab1190a2..900a6198e97 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,13 @@ +2013-11-07 Joseph Myers <joseph@codesourcery.com> + + * fenv.c: New file. + * libatomic.map (LIBATOMIC_1.1): New symbol version. Include + __atomic_feraiseexcept. + * configure.ac (libtool_VERSION): Change to 2:0:1. + (fenv.h): Test for header. + * Makefile.am (libatomic_la_SOURCES): Add fenv.c. + * Makefile.in, auto-config.h.in, configure: Regenerate. + 2013-10-17 Michael Hudson-Doyle <michael.hudson@linaro.org> * libatomic/configure.tgt (aarch64*): Remove code preventing diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am index a98ee6437ce..537b24a7149 100644 --- a/libatomic/Makefile.am +++ b/libatomic/Makefile.am @@ -67,7 +67,8 @@ endif libatomic_version_info = -version-info $(libtool_VERSION) libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) -libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c +libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \ + fenv.c SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas SIZES = @SIZES@ diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in index 46e60c94cdb..22c384b4322 100644 --- a/libatomic/Makefile.in +++ b/libatomic/Makefile.in @@ -90,14 +90,14 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) am_libatomic_la_OBJECTS = gload.lo gstore.lo gcas.lo gexch.lo \ - glfree.lo lock.lo init.lo + glfree.lo lock.lo init.lo fenv.lo libatomic_la_OBJECTS = $(am_libatomic_la_OBJECTS) libatomic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libatomic_la_LDFLAGS) $(LDFLAGS) -o $@ libatomic_convenience_la_DEPENDENCIES = $(libatomic_la_LIBADD) am__objects_1 = gload.lo gstore.lo gcas.lo gexch.lo glfree.lo lock.lo \ - init.lo + init.lo fenv.lo am_libatomic_convenience_la_OBJECTS = $(am__objects_1) libatomic_convenience_la_OBJECTS = \ $(am_libatomic_convenience_la_OBJECTS) @@ -286,7 +286,9 @@ noinst_LTLIBRARIES = libatomic_convenience.la @LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun libatomic_version_info = -version-info $(libtool_VERSION) libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) -libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c +libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \ + fenv.c + SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas EXTRA_libatomic_la_SOURCES = $(addsuffix _n.c,$(SIZEOBJS)) libatomic_la_DEPENDENCIES = $(libatomic_la_LIBADD) $(libatomic_version_dep) @@ -425,6 +427,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fenv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcas.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gexch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glfree.Plo@am__quote@ diff --git a/libatomic/auto-config.h.in b/libatomic/auto-config.h.in index ab080e7d6e4..83e54e2db3b 100644 --- a/libatomic/auto-config.h.in +++ b/libatomic/auto-config.h.in @@ -105,6 +105,9 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you have the <fenv.h> header file. */ +#undef HAVE_FENV_H + /* Define to 1 if the target supports __attribute__((ifunc(...))). */ #undef HAVE_IFUNC diff --git a/libatomic/configure b/libatomic/configure index 6a27ebdad9f..d707b096c2e 100755 --- a/libatomic/configure +++ b/libatomic/configure @@ -2000,6 +2000,93 @@ rm -f conftest.val return $ac_retval } # ac_fn_c_compute_int + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -11019,7 +11106,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11022 "configure" +#line 11109 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11125,7 +11212,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11128 "configure" +#line 11215 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11389,7 +11476,7 @@ fi # For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=1:0:0 +libtool_VERSION=2:0:1 # Get target configury. @@ -11953,6 +12040,18 @@ ac_config_commands="$ac_config_commands gstdint.h" +for ac_header in fenv.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "fenv.h" "ac_cv_header_fenv_h" "$ac_includes_default" +if test "x$ac_cv_header_fenv_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FENV_H 1 +_ACEOF + +fi + +done + # Check for common type sizes diff --git a/libatomic/configure.ac b/libatomic/configure.ac index 0dc4a9809ec..fd2d35bf04f 100644 --- a/libatomic/configure.ac +++ b/libatomic/configure.ac @@ -148,7 +148,7 @@ AC_SUBST(enable_static) AM_MAINTAINER_MODE # For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=1:0:0 +libtool_VERSION=2:0:1 AC_SUBST(libtool_VERSION) # Get target configury. @@ -165,6 +165,7 @@ CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS" AC_STDC_HEADERS ACX_HEADER_STRING GCC_HEADER_STDINT(gstdint.h) +AC_CHECK_HEADERS([fenv.h]) # Check for common type sizes LIBAT_FORALL_MODES([LIBAT_HAVE_INT_MODE]) diff --git a/libatomic/fenv.c b/libatomic/fenv.c new file mode 100644 index 00000000000..752cf3b378d --- /dev/null +++ b/libatomic/fenv.c @@ -0,0 +1,72 @@ +/* Copyright (C) 2012-2013 Free Software Foundation, Inc. + + This file is part of the GNU Atomic Library (libatomic). + + Libatomic is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Libatomic 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 General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +#include "libatomic_i.h" + +#ifdef HAVE_FENV_H +# include <fenv.h> +#endif + +/* Raise the supported floating-point exceptions from EXCEPTS. Other + bits in EXCEPTS are ignored. */ + +void +__atomic_feraiseexcept (int excepts __attribute__ ((unused))) +{ + volatile float r __attribute__ ((unused)); +#ifdef FE_INVALID + if (excepts & FE_INVALID) + { + volatile float zero = 0.0f; + r = zero / zero; + } +#endif +#ifdef FE_DIVBYZERO + if (excepts & FE_DIVBYZERO) + { + volatile float zero = 0.0f; + r = 1.0f / zero; + } +#endif +#ifdef FE_OVERFLOW + if (excepts & FE_OVERFLOW) + { + volatile float max = __FLT_MAX__; + r = max * max; + } +#endif +#ifdef FE_UNDERFLOW + if (excepts & FE_UNDERFLOW) + { + volatile float min = __FLT_MIN__; + r = min * min; + } +#endif +#ifdef FE_INEXACT + if (excepts & FE_INEXACT) + { + volatile float three = 3.0f; + r = 1.0f / three; + } +#endif +} diff --git a/libatomic/libatomic.map b/libatomic/libatomic.map index bcf077370a9..8fd2bafd80c 100644 --- a/libatomic/libatomic.map +++ b/libatomic/libatomic.map @@ -95,3 +95,7 @@ LIBATOMIC_1.0 { local: *; }; +LIBATOMIC_1.1 { + global: + __atomic_feraiseexcept; +} LIBATOMIC_1.0; |