diff --git a/libgloss/cris/gensyscalls b/libgloss/cris/gensyscalls index 3e2f9af8c..c36f28488 100644 --- a/libgloss/cris/gensyscalls +++ b/libgloss/cris/gensyscalls @@ -60,6 +60,9 @@ EOF cat > fstat.c < #include +#undef st_atime +#undef st_mtime +#undef st_ctime int _fstat (int fd, struct stat *buf) { @@ -81,9 +84,9 @@ _fstat (int fd, struct stat *buf) buf->st_size = ks.st_size; buf->st_blksize = ks.st_blksize; buf->st_blocks = ks.st_blocks; - buf->st_atime = ks.st_atime; - buf->st_mtime = ks.st_mtime; - buf->st_ctime = ks.st_ctime; + buf->st_atim.tv_sec = ks.st_atime; + buf->st_mtim.tv_sec = ks.st_mtime; + buf->st_ctim.tv_sec = ks.st_ctime; R (retval) EOF cat > getpid.c < stat.c < #include +#undef st_atime +#undef st_mtime +#undef st_ctime int _stat (const char *path, struct stat *buf) { @@ -237,9 +243,9 @@ _stat (const char *path, struct stat *buf) buf->st_size = ks.st_size; buf->st_blksize = ks.st_blksize; buf->st_blocks = ks.st_blocks; - buf->st_atime = ks.st_atime; - buf->st_mtime = ks.st_mtime; - buf->st_ctime = ks.st_ctime; + buf->st_atim.tv_sec = ks.st_atime; + buf->st_mtim.tv_sec = ks.st_mtime; + buf->st_ctim.tv_sec = ks.st_ctime; R (retval) EOF cat > times.c <st_size = gs->st_size; s->st_blksize = gs->st_blksize; s->st_blocks = gs->st_blocks; - s->st_atime = gs->st_atime; - s->st_mtime = gs->st_mtime; - s->st_ctime = gs->st_ctime; + s->st_atime = gs->st_atim; + s->st_mtime = gs->st_mtim; + s->st_ctime = gs->st_ctim; } void diff --git a/libgloss/visium/io.h b/libgloss/visium/io.h index a1bb879fb..9cb76ea30 100644 --- a/libgloss/visium/io.h +++ b/libgloss/visium/io.h @@ -57,9 +57,9 @@ struct gdb_stat { uint64_t st_size; /* total size, in bytes */ uint64_t st_blksize; /* blocksize for filesystem I/O */ uint64_t st_blocks; /* number of blocks allocated */ - gdb_time_t st_atime; /* time of last access */ - gdb_time_t st_mtime; /* time of last modification */ - gdb_time_t st_ctime; /* time of last change */ + gdb_time_t st_atim; /* time of last access */ + gdb_time_t st_mtim; /* time of last modification */ + gdb_time_t st_ctim; /* time of last change */ }; struct gdb_timeval { diff --git a/newlib/doc/makedocbook.py b/newlib/doc/makedocbook.py index cf48c3402..97255345d 100755 --- a/newlib/doc/makedocbook.py +++ b/newlib/doc/makedocbook.py @@ -297,6 +297,8 @@ def synopsis(c, t): # preprocessor # directives, structs, comments in square brackets funcsynopsisinfo = lxml.etree.SubElement(funcsynopsis, 'funcsynopsisinfo') funcsynopsisinfo.text = l.strip() + '\n' + elif re.match('[Ll]ink with', l): + pass else: s = s + l @@ -312,7 +314,7 @@ def synopsis(c, t): if s.strip(): print("surplus synopsis '%s'" % s, file=sys.stderr) - raise + exit(1) def synopsis_for_prototype(funcsynopsis, s): s = s.strip() diff --git a/newlib/libc/include/fenv.h b/newlib/libc/include/fenv.h new file mode 100644 index 000000000..4795cc925 --- /dev/null +++ b/newlib/libc/include/fenv.h @@ -0,0 +1,42 @@ +/* Copyright (c) 2017 SiFive Inc. All rights reserved. + + This copyrighted material is made available to anyone wishing to use, + modify, copy, or redistribute it subject to the terms and conditions + of the FreeBSD License. This program is distributed in the hope that + it will be useful, but WITHOUT ANY WARRANTY expressed or implied, + including the implied warranties of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. A copy of this license is available at + http://www.opensource.org/licenses. +*/ + +#ifndef _FENV_H +#define _FENV_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exception */ +int feclearexcept(int excepts); +int fegetexceptflag(fexcept_t *flagp, int excepts); +int feraiseexcept(int excepts); +int fesetexceptflag(const fexcept_t *flagp, int excepts); +int fetestexcept(int excepts); + +/* Rounding mode */ +int fegetround(void); +int fesetround(int rounding_mode); + +/* Float environment */ +int fegetenv(fenv_t *envp); +int feholdexcept(fenv_t *envp); +int fesetenv(const fenv_t *envp); +int feupdateenv(const fenv_t *envp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/newlib/libc/include/sched.h b/newlib/libc/include/sched.h index 79b775e22..31599aa7e 100644 --- a/newlib/libc/include/sched.h +++ b/newlib/libc/include/sched.h @@ -93,10 +93,16 @@ int sched_yield( void ); #if __GNU_VISIBLE int sched_getcpu(void); +/* The following functions should only be declared if the type + cpu_set_t is defined through indirect inclusion of sys/cpuset.h, + only available on some targets. */ +#ifdef _SYS_CPUSET_H_ int sched_getaffinity (pid_t, size_t, cpu_set_t *); int sched_get_thread_affinity (void *, size_t, cpu_set_t *); int sched_setaffinity (pid_t, size_t, const cpu_set_t *); int sched_set_thread_affinity (void *, size_t, const cpu_set_t *); +#endif /* _SYS_CPUSET_H_ */ + #endif #ifdef __cplusplus diff --git a/newlib/libc/include/sys/fenv.h b/newlib/libc/include/sys/fenv.h new file mode 100644 index 000000000..e0983fa2c --- /dev/null +++ b/newlib/libc/include/sys/fenv.h @@ -0,0 +1,113 @@ +/* + (c) Copyright 2019 Joel Sherrill + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _SYS_FENV_H_ +#define _SYS_FENV_H_ + +/******************************************************************************* + * THIS FILE IS A TEMPLATE, INTENDED TO BE USED AS A STARTING POINT FOR + * TARGET-SPECIFIC FLOATING-POINT IMPLEMENTATIONS. NOTES BELOW HIGHLIGHT THE + * BASICS OF WHAT NEEDS TO BE DEFINED. THE DEFAULT IMPLEMTATION IS + * DEGENERATE, WITH ALL FUNCTIONS RETURNING ERROR AND NO EXCEPTIONS AND NO + * ROUNDING MODES DEFINED (SINCE NONE ARE SUPPORTED). + * THE MACRO VALUES ARE EXAMPLES ONLY, ALTHOUGH TAKEN FROM A WORKING + * IMPLEMENTATION. + * REMOVE THIS NOTICE WHEN COPYING TO A REAL IMPLEMENTATION, REPLACING IT WITH + * ANY TARGET-SPECIFIC NOTES OF INTEREST. THE FENV FUNCTION MAN PAGES POINT TO + * THIS FILE AS A MEANS OF DETERMINING A FUNCTIONAL VS. NON-FUNCTIONAL + * IMPLEMENTATION. + ******************************************************************************/ +/* + * The following macros are to be defined if the respective exception is + * supported by the implementation, each with a unique bit mask: + * + * FE_DIVBYZERO + * FE_INEXACT + * FE_INVALID + * FE_OVERFLOW + * FE_UNDERFLOW + * + * Other implementation-specific exceptions may be defined, and must start + * with FE_ followed by a capital letter. + * + * FE_ALL_EXCEPT must be defined as the logical OR of all exceptions. + */ +//#define FE_DIVBYZERO 0x00000001 +//#define FE_INEXACT 0x00000002 +//#define FE_INVALID 0x00000004 +//#define FE_OVERFLOW 0x00000008 +//#define FE_UNDERFLOW 0x00000010 + +//#define FE_ALL_EXCEPT \ + //(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW) +#define FE_ALL_EXCEPT 0 /* NONE SUPPORTED IN PLACEHOLDER TEMPLATE */ + +/* + * The following macros are to be defined if the respective rounding + * direction is supported by the implementation via the fegetround() and + * fesetround() functions, each with a unique positive value. + * + * FE_DOWNWARD + * FE_TONEAREST + * FE_TOWARDZERO + * FE_UPWARD + * + * Other implementation-specific rounding modes may be defined, and must start + * with FE_ followed by a capital letter. + */ +//#define FE_DOWNWARD 1 +//#define FE_TONEAREST 2 +//#define FE_TOWARDZERO 3 +//#define FE_UPWARD 4 + +/* + * The following typedefs are required. These should be defined properly + * to support the architecture specific implementation. See the C and + * POSIX standards for details: + * + * fenv_t + * fexcept_t + */ +typedef int fenv_t; +typedef int fexcept_t; + +/* + * Lastly, a FE_DFL_ENV macro must be defined, representing a pointer + * to const fenv_t that contains the value of the default floating point + * environment. + * + * NOTE: The extern'ed variable fe_default_env_p is an implementation + * detail of this stub. FE_DFL_ENV must point to an instance of + * fenv_t with the default fenv_t. The format of fenv_t and where + * FE_DFL_ENV is are implementation specific. + */ +extern const fenv_t *_fe_dfl_env; +#define FE_DFL_ENV _fe_dfl_env + +#endif /* _SYS_FENV_H_ */ diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index eee98db64..8769112b0 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -34,33 +34,23 @@ struct stat gid_t st_gid; dev_t st_rdev; off_t st_size; -#if defined(__rtems__) - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - blksize_t st_blksize; - blkcnt_t st_blocks; -#else - /* SysV/sco doesn't have the rest... But Solaris, eabi does. */ #if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) time_t st_atime; time_t st_mtime; time_t st_ctime; #else - time_t st_atime; - long st_spare1; - time_t st_mtime; - long st_spare2; - time_t st_ctime; - long st_spare3; - blksize_t st_blksize; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + blksize_t st_blksize; blkcnt_t st_blocks; - long st_spare4[2]; +#if !defined(__rtems__) + long st_spare4[2]; #endif #endif }; -#if defined(__rtems__) +#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)) && !defined(__cris__) #define st_atime st_atim.tv_sec #define st_ctime st_ctim.tv_sec #define st_mtime st_mtim.tv_sec diff --git a/newlib/libc/machine/msp430/Makefile.in b/newlib/libc/machine/msp430/Makefile.in index 6f837c91f..efbdf7cf4 100644 --- a/newlib/libc/machine/msp430/Makefile.in +++ b/newlib/libc/machine/msp430/Makefile.in @@ -198,7 +198,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/newlib/libc/machine/riscv/Makefile.in b/newlib/libc/machine/riscv/Makefile.in index 304dd35ae..e6dee8763 100644 --- a/newlib/libc/machine/riscv/Makefile.in +++ b/newlib/libc/machine/riscv/Makefile.in @@ -69,9 +69,9 @@ LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru lib_a_AR = $(AR) $(ARFLAGS) lib_a_LIBADD = -am_lib_a_OBJECTS = lib_a-memset.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \ - lib_a-memcpy-asm.$(OBJEXT) \ - lib_a-memmove.$(OBJEXT) lib_a-memmove-stub.$(OBJEXT) \ +am_lib_a_OBJECTS = lib_a-memmove.$(OBJEXT) \ + lib_a-memmove-stub.$(OBJEXT) lib_a-memset.$(OBJEXT) \ + lib_a-memcpy-asm.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \ lib_a-strlen.$(OBJEXT) lib_a-strcpy.$(OBJEXT) \ lib_a-strcmp.$(OBJEXT) lib_a-setjmp.$(OBJEXT) \ lib_a-ieeefp.$(OBJEXT) lib_a-ffs.$(OBJEXT) @@ -200,8 +200,9 @@ AUTOMAKE_OPTIONS = cygnus INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) AM_CCASFLAGS = $(INCLUDES) noinst_LIBRARIES = lib.a -lib_a_SOURCES = memcpy-asm.S memmove.S memmove-stub.c memset.S memcpy.c strlen.c \ +lib_a_SOURCES = memmove.S memmove-stub.c memset.S memcpy-asm.S memcpy.c strlen.c \ strcpy.c strcmp.S setjmp.S ieeefp.c ffs.c + lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CFLAGS = $(AM_CFLAGS) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. @@ -270,18 +271,18 @@ lib_a-memmove.o: memmove.S lib_a-memmove.obj: memmove.S $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memmove.obj `if test -f 'memmove.S'; then $(CYGPATH_W) 'memmove.S'; else $(CYGPATH_W) '$(srcdir)/memmove.S'; fi` -lib_a-memcpy-asm.o: memcpy-asm.S - $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy-asm.o `test -f 'memcpy-asm.S' || echo '$(srcdir)/'`memcpy-asm.S - -lib_a-memcpy-asm.obj: memcpy-asm.S - $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy-asm.obj `if test -f 'memcpy-asm.S'; then $(CYGPATH_W) 'memcpy-asm.S'; else $(CYGPATH_W) '$(srcdir)/memcpy-asm.S'; fi` - lib_a-memset.o: memset.S $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memset.o `test -f 'memset.S' || echo '$(srcdir)/'`memset.S lib_a-memset.obj: memset.S $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memset.obj `if test -f 'memset.S'; then $(CYGPATH_W) 'memset.S'; else $(CYGPATH_W) '$(srcdir)/memset.S'; fi` +lib_a-memcpy-asm.o: memcpy-asm.S + $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy-asm.o `test -f 'memcpy-asm.S' || echo '$(srcdir)/'`memcpy-asm.S + +lib_a-memcpy-asm.obj: memcpy-asm.S + $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy-asm.obj `if test -f 'memcpy-asm.S'; then $(CYGPATH_W) 'memcpy-asm.S'; else $(CYGPATH_W) '$(srcdir)/memcpy-asm.S'; fi` + lib_a-strcmp.o: strcmp.S $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcmp.o `test -f 'strcmp.S' || echo '$(srcdir)/'`strcmp.S diff --git a/newlib/libc/search/Makefile.in b/newlib/libc/search/Makefile.in index 8077a5f27..433047277 100644 --- a/newlib/libc/search/Makefile.in +++ b/newlib/libc/search/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.12.2 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -53,11 +54,15 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/../../mkinstalldirs + $(srcdir)/Makefile.am subdir = search ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../acinclude.m4 \ - $(top_srcdir)/configure.in +am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/../../lt~obsolete.m4 \ + $(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs @@ -182,10 +187,8 @@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ NM = @NM@ @@ -214,7 +217,6 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ aext = @aext@ @@ -374,14 +376,12 @@ lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES) clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done libsearch.la: $(libsearch_la_OBJECTS) $(libsearch_la_DEPENDENCIES) $(EXTRA_libsearch_la_DEPENDENCIES) $(libsearch_la_LINK) $(am_libsearch_la_rpath) $(libsearch_la_OBJECTS) $(libsearch_la_LIBADD) $(LIBS) @@ -563,20 +563,6 @@ GTAGS: && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-am: @@ -687,7 +673,7 @@ uninstall-am: .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ - cscopelist ctags distclean distclean-compile distclean-generic \ + ctags distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ diff --git a/newlib/libc/string/memmem.c b/newlib/libc/string/memmem.c index 55d2459aa..65267b9c5 100644 --- a/newlib/libc/string/memmem.c +++ b/newlib/libc/string/memmem.c @@ -143,10 +143,11 @@ memmem (const void *haystack, size_t hs_len, const void *needle, size_t ne_len) size_t tmp, shift1; size_t m1 = ne_len - 1; size_t offset = 0; + int i; /* Initialize bad character shift hash table. */ memset (shift, 0, sizeof (shift)); - for (int i = 1; i < m1; i++) + for (i = 1; i < m1; i++) shift[hash2 (ne + i)] = i; shift1 = m1 - shift[hash2 (ne + m1)]; shift[hash2 (ne + m1)] = m1; diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c index 0256c1aa6..00fe060e9 100644 --- a/newlib/libc/string/strstr.c +++ b/newlib/libc/string/strstr.c @@ -102,7 +102,8 @@ strstr2 (const unsigned char *hs, const unsigned char *ne) { uint32_t h1 = (ne[0] << 16) | ne[1]; uint32_t h2 = 0; - for (int c = hs[0]; h1 != h2 && c != 0; c = *++hs) + int c; + for (c = hs[0]; h1 != h2 && c != 0; c = *++hs) h2 = (h2 << 16) | c; return h1 == h2 ? (char *)hs - 2 : NULL; } @@ -112,7 +113,8 @@ strstr3 (const unsigned char *hs, const unsigned char *ne) { uint32_t h1 = (ne[0] << 24) | (ne[1] << 16) | (ne[2] << 8); uint32_t h2 = 0; - for (int c = hs[0]; h1 != h2 && c != 0; c = *++hs) + int c; + for (c = hs[0]; h1 != h2 && c != 0; c = *++hs) h2 = (h2 | c) << 8; return h1 == h2 ? (char *)hs - 3 : NULL; } @@ -122,7 +124,8 @@ strstr4 (const unsigned char *hs, const unsigned char *ne) { uint32_t h1 = (ne[0] << 24) | (ne[1] << 16) | (ne[2] << 8) | ne[3]; uint32_t h2 = 0; - for (int c = hs[0]; c != 0 && h1 != h2; c = *++hs) + int c; + for (c = hs[0]; c != 0 && h1 != h2; c = *++hs) h2 = (h2 << 8) | c; return h1 == h2 ? (char *)hs - 4 : NULL; } @@ -142,6 +145,7 @@ strstr (const char *haystack, const char *needle) { const unsigned char *hs = (const unsigned char *) haystack; const unsigned char *ne = (const unsigned char *) needle; + int i; /* Handle short needle special cases first. */ if (ne[0] == '\0') @@ -170,7 +174,7 @@ strstr (const char *haystack, const char *needle) /* Initialize bad character shift hash table. */ memset (shift, ne_len + 1, sizeof (shift)); - for (int i = 0; i < ne_len; i++) + for (i = 0; i < ne_len; i++) shift[ne[i] % sizeof (shift)] = ne_len - i; do diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am index 8bc2c2cfe..05afcbffc 100644 --- a/newlib/libm/Makefile.am +++ b/newlib/libm/Makefile.am @@ -8,17 +8,17 @@ else MATHDIR = math endif -SUBDIRS = $(MATHDIR) common complex machine +SUBDIRS = $(MATHDIR) common complex fenv machine libm_la_LDFLAGS = -Xcompiler -nostdlib if USE_LIBTOOL -SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) $(LIBM_MACHINE_LIB) +SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) fenv/libfenv.$(aext) $(LIBM_MACHINE_LIB) noinst_LTLIBRARIES = libm.la libm_la_SOURCES = libm_la_LIBADD = $(SUBLIBS) else -SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) $(LIBM_MACHINE_LIB) +SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) fenv/lib.$(aext) $(LIBM_MACHINE_LIB) noinst_LIBRARIES = libm.a libm.a: $(SUBLIBS) rm -f $@ @@ -39,7 +39,7 @@ info_TEXINFOS = libm.texinfo libm_TEXINFOS = targetdep.tex -libm.dvi: targetdep.tex math/stmp-def complex/stmp-def +libm.dvi: targetdep.tex math/stmp-def complex/stmp-def fenv/stmp-def stmp-targetdep: force rm -f tmp.texi @@ -58,6 +58,8 @@ math/stmp-def: stmp-targetdep ; @true complex/stmp-def: stmp-targetdep ; @true +fenv/stmp-def: stmp-targetdep ; @true + docbook-recursive: force for d in $(SUBDIRS); do \ if test "$$d" != "."; then \ diff --git a/newlib/libm/Makefile.in b/newlib/libm/Makefile.in index 59a53b528..dd1a71750 100644 --- a/newlib/libm/Makefile.in +++ b/newlib/libm/Makefile.in @@ -80,12 +80,12 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = @USE_LIBTOOL_FALSE@am__DEPENDENCIES_2 = $(MATHDIR)/lib.$(aext) \ @USE_LIBTOOL_FALSE@ common/lib.$(aext) complex/lib.$(aext) \ -@USE_LIBTOOL_FALSE@ $(am__DEPENDENCIES_1) +@USE_LIBTOOL_FALSE@ fenv/lib.$(aext) $(am__DEPENDENCIES_1) @USE_LIBTOOL_TRUE@am__DEPENDENCIES_2 = \ @USE_LIBTOOL_TRUE@ $(MATHDIR)/lib$(MATHDIR).$(aext) \ @USE_LIBTOOL_TRUE@ common/libcommon.$(aext) \ @USE_LIBTOOL_TRUE@ complex/libcomplex.$(aext) \ -@USE_LIBTOOL_TRUE@ $(am__DEPENDENCIES_1) +@USE_LIBTOOL_TRUE@ fenv/libfenv.$(aext) $(am__DEPENDENCIES_1) @USE_LIBTOOL_TRUE@libm_la_DEPENDENCIES = $(am__DEPENDENCIES_2) am_libm_la_OBJECTS = libm_la_OBJECTS = $(am_libm_la_OBJECTS) @@ -168,7 +168,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = math mathfp common complex machine +DIST_SUBDIRS = math mathfp common complex fenv machine ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ @@ -299,10 +299,10 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = cygnus @NEWLIB_HW_FP_FALSE@MATHDIR = math @NEWLIB_HW_FP_TRUE@MATHDIR = mathfp -SUBDIRS = $(MATHDIR) common complex machine +SUBDIRS = $(MATHDIR) common complex fenv machine libm_la_LDFLAGS = -Xcompiler -nostdlib -@USE_LIBTOOL_FALSE@SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) $(LIBM_MACHINE_LIB) -@USE_LIBTOOL_TRUE@SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) $(LIBM_MACHINE_LIB) +@USE_LIBTOOL_FALSE@SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) fenv/lib.$(aext) $(LIBM_MACHINE_LIB) +@USE_LIBTOOL_TRUE@SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) fenv/libfenv.$(aext) $(LIBM_MACHINE_LIB) @USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libm.la @USE_LIBTOOL_TRUE@libm_la_SOURCES = @USE_LIBTOOL_TRUE@libm_la_LIBADD = $(SUBLIBS) diff --git a/newlib/libm/configure b/newlib/libm/configure index e8a0a994a..309a6683f 100755 --- a/newlib/libm/configure +++ b/newlib/libm/configure @@ -11868,7 +11868,7 @@ fi -ac_config_files="$ac_config_files Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile" +ac_config_files="$ac_config_files Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile fenv/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -12930,6 +12930,7 @@ do "mathfp/Makefile") CONFIG_FILES="$CONFIG_FILES mathfp/Makefile" ;; "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;; "complex/Makefile") CONFIG_FILES="$CONFIG_FILES complex/Makefile" ;; + "fenv/Makefile") CONFIG_FILES="$CONFIG_FILES fenv/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/newlib/libm/configure.in b/newlib/libm/configure.in index 9bd107c59..aec22bd4e 100644 --- a/newlib/libm/configure.in +++ b/newlib/libm/configure.in @@ -62,5 +62,5 @@ fi AC_SUBST(LIBM_MACHINE_LIB) -AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile]) +AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile fenv/Makefile]) AC_OUTPUT diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am new file mode 100644 index 000000000..ebe03970b --- /dev/null +++ b/newlib/libm/fenv/Makefile.am @@ -0,0 +1,36 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +src = feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ + fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c + +libcommon_la_LDFLAGS = -Xcompiler -nostdlib +lib_a_CFLAGS = -fbuiltin -fno-math-errno + +if USE_LIBTOOL +noinst_LTLIBRARIES = libcommon.la +libcommon_la_SOURCES = $(src) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(src) +lib_a_CFLAGS += $(AM_CFLAGS) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../Makefile.shared + +CHEWOUT_FILES = feclearexcept.def fegetenv.def \ + fegetexceptflag.def fegetround.def feholdexcept.def \ + feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \ + fetestexcept.def feupdateenv.def + +CHAPTERS = fenv.tex + +# A partial dependency list. + +$(lib_a_OBJECTS): $(srcdir)/../../libc/include/fenv.h diff --git a/newlib/libm/fenv/Makefile.in b/newlib/libm/fenv/Makefile.in new file mode 100644 index 000000000..b2adb823a --- /dev/null +++ b/newlib/libm/fenv/Makefile.in @@ -0,0 +1,628 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@USE_LIBTOOL_FALSE@am__append_1 = $(AM_CFLAGS) +DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am +subdir = fenv +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/../../lt~obsolete.m4 \ + $(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +lib_a_AR = $(AR) $(ARFLAGS) +lib_a_LIBADD = +am__objects_1 = lib_a-feclearexcept.$(OBJEXT) \ + lib_a-fe_dfl_env.$(OBJEXT) lib_a-fegetenv.$(OBJEXT) \ + lib_a-fegetexceptflag.$(OBJEXT) lib_a-fegetround.$(OBJEXT) \ + lib_a-feholdexcept.$(OBJEXT) lib_a-feraiseexcept.$(OBJEXT) \ + lib_a-fesetenv.$(OBJEXT) lib_a-fesetexceptflag.$(OBJEXT) \ + lib_a-fesetround.$(OBJEXT) lib_a-fetestexcept.$(OBJEXT) \ + lib_a-feupdateenv.$(OBJEXT) +@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) +lib_a_OBJECTS = $(am_lib_a_OBJECTS) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libcommon_la_LIBADD = +am__objects_2 = feclearexcept.lo fe_dfl_env.lo fegetenv.lo \ + fegetexceptflag.lo fegetround.lo feholdexcept.lo \ + feraiseexcept.lo fesetenv.lo fesetexceptflag.lo fesetround.lo \ + fetestexcept.lo feupdateenv.lo +@USE_LIBTOOL_TRUE@am_libcommon_la_OBJECTS = $(am__objects_2) +libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) +libcommon_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libcommon_la_LDFLAGS) $(LDFLAGS) -o $@ +@USE_LIBTOOL_TRUE@am_libcommon_la_rpath = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(lib_a_SOURCES) $(libcommon_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +ETAGS = etags +CTAGS = ctags +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBM_MACHINE_LIB = @LIBM_MACHINE_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_INCLUDE_LIST = @NO_INCLUDE_LIST@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +READELF = @READELF@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +aext = @aext@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libm_machine_dir = @libm_machine_dir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lpfx = @lpfx@ +machine_dir = @machine_dir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sys_dir = @sys_dir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = cygnus +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) +src = feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ + fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c + +libcommon_la_LDFLAGS = -Xcompiler -nostdlib +lib_a_CFLAGS = -fbuiltin -fno-math-errno $(am__append_1) +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libcommon.la +@USE_LIBTOOL_TRUE@libcommon_la_SOURCES = $(src) +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(src) + +# +# documentation rules +# +SUFFIXES = .def .xml +CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str +DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py +DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) +DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) +CHEWOUT_FILES = feclearexcept.def fegetenv.def \ + fegetexceptflag.def fegetround.def feholdexcept.def \ + feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \ + fetestexcept.def feupdateenv.def + +CHAPTERS = fenv.tex +all: all-am + +.SUFFIXES: +.SUFFIXES: .def .xml .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../Makefile.shared $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus fenv/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --cygnus fenv/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(srcdir)/../../Makefile.shared: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES) + -rm -f lib.a + $(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) $(EXTRA_libcommon_la_DEPENDENCIES) + $(libcommon_la_LINK) $(am_libcommon_la_rpath) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -c -o $@ $< + +lib_a-feclearexcept.o: feclearexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feclearexcept.o `test -f 'feclearexcept.c' || echo '$(srcdir)/'`feclearexcept.c + +lib_a-feclearexcept.obj: feclearexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feclearexcept.obj `if test -f 'feclearexcept.c'; then $(CYGPATH_W) 'feclearexcept.c'; else $(CYGPATH_W) '$(srcdir)/feclearexcept.c'; fi` + +lib_a-fe_dfl_env.o: fe_dfl_env.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fe_dfl_env.o `test -f 'fe_dfl_env.c' || echo '$(srcdir)/'`fe_dfl_env.c + +lib_a-fe_dfl_env.obj: fe_dfl_env.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fe_dfl_env.obj `if test -f 'fe_dfl_env.c'; then $(CYGPATH_W) 'fe_dfl_env.c'; else $(CYGPATH_W) '$(srcdir)/fe_dfl_env.c'; fi` + +lib_a-fegetenv.o: fegetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetenv.o `test -f 'fegetenv.c' || echo '$(srcdir)/'`fegetenv.c + +lib_a-fegetenv.obj: fegetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetenv.obj `if test -f 'fegetenv.c'; then $(CYGPATH_W) 'fegetenv.c'; else $(CYGPATH_W) '$(srcdir)/fegetenv.c'; fi` + +lib_a-fegetexceptflag.o: fegetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetexceptflag.o `test -f 'fegetexceptflag.c' || echo '$(srcdir)/'`fegetexceptflag.c + +lib_a-fegetexceptflag.obj: fegetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetexceptflag.obj `if test -f 'fegetexceptflag.c'; then $(CYGPATH_W) 'fegetexceptflag.c'; else $(CYGPATH_W) '$(srcdir)/fegetexceptflag.c'; fi` + +lib_a-fegetround.o: fegetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetround.o `test -f 'fegetround.c' || echo '$(srcdir)/'`fegetround.c + +lib_a-fegetround.obj: fegetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetround.obj `if test -f 'fegetround.c'; then $(CYGPATH_W) 'fegetround.c'; else $(CYGPATH_W) '$(srcdir)/fegetround.c'; fi` + +lib_a-feholdexcept.o: feholdexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feholdexcept.o `test -f 'feholdexcept.c' || echo '$(srcdir)/'`feholdexcept.c + +lib_a-feholdexcept.obj: feholdexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feholdexcept.obj `if test -f 'feholdexcept.c'; then $(CYGPATH_W) 'feholdexcept.c'; else $(CYGPATH_W) '$(srcdir)/feholdexcept.c'; fi` + +lib_a-feraiseexcept.o: feraiseexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feraiseexcept.o `test -f 'feraiseexcept.c' || echo '$(srcdir)/'`feraiseexcept.c + +lib_a-feraiseexcept.obj: feraiseexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feraiseexcept.obj `if test -f 'feraiseexcept.c'; then $(CYGPATH_W) 'feraiseexcept.c'; else $(CYGPATH_W) '$(srcdir)/feraiseexcept.c'; fi` + +lib_a-fesetenv.o: fesetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetenv.o `test -f 'fesetenv.c' || echo '$(srcdir)/'`fesetenv.c + +lib_a-fesetenv.obj: fesetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetenv.obj `if test -f 'fesetenv.c'; then $(CYGPATH_W) 'fesetenv.c'; else $(CYGPATH_W) '$(srcdir)/fesetenv.c'; fi` + +lib_a-fesetexceptflag.o: fesetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetexceptflag.o `test -f 'fesetexceptflag.c' || echo '$(srcdir)/'`fesetexceptflag.c + +lib_a-fesetexceptflag.obj: fesetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetexceptflag.obj `if test -f 'fesetexceptflag.c'; then $(CYGPATH_W) 'fesetexceptflag.c'; else $(CYGPATH_W) '$(srcdir)/fesetexceptflag.c'; fi` + +lib_a-fesetround.o: fesetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetround.o `test -f 'fesetround.c' || echo '$(srcdir)/'`fesetround.c + +lib_a-fesetround.obj: fesetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetround.obj `if test -f 'fesetround.c'; then $(CYGPATH_W) 'fesetround.c'; else $(CYGPATH_W) '$(srcdir)/fesetround.c'; fi` + +lib_a-fetestexcept.o: fetestexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fetestexcept.o `test -f 'fetestexcept.c' || echo '$(srcdir)/'`fetestexcept.c + +lib_a-fetestexcept.obj: fetestexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fetestexcept.obj `if test -f 'fetestexcept.c'; then $(CYGPATH_W) 'fetestexcept.c'; else $(CYGPATH_W) '$(srcdir)/fetestexcept.c'; fi` + +lib_a-feupdateenv.o: feupdateenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.o `test -f 'feupdateenv.c' || echo '$(srcdir)/'`feupdateenv.c + +lib_a-feupdateenv.obj: feupdateenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.obj `if test -f 'feupdateenv.c'; then $(CYGPATH_W) 'feupdateenv.c'; else $(CYGPATH_W) '$(srcdir)/feupdateenv.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: +check: check-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +.c.def: + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def + +TARGETDOC ?= ../tmp.texi + +doc: $(CHEWOUT_FILES) + for chapter in $(CHAPTERS) ; \ + do \ + cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \ + done + +.c.xml: + $(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false ) + @touch stmp-xml + +docbook: $(DOCBOOK_OUT_FILES) + for chapter in $(DOCBOOK_CHAPTERS) ; \ + do \ + ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \ + done + +# A partial dependency list. + +$(lib_a_OBJECTS): $(srcdir)/../../libc/include/fenv.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newlib/libm/fenv/fe_dfl_env.c b/newlib/libm/fenv/fe_dfl_env.c new file mode 100644 index 000000000..0606327fa --- /dev/null +++ b/newlib/libm/fenv/fe_dfl_env.c @@ -0,0 +1,42 @@ +/* + (c) Copyright 2019 Joel Sherrill + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + * + * The implementation must defined FE_DFL_ENV to point to a default + * environment of type fenv_t. + */ + +/* Non-static and writable to allow initialization at startup. */ +fenv_t __fe_dfl_env = { 0 }; + +const fenv_t *_fe_dfl_env = &__fe_dfl_env; diff --git a/newlib/libm/fenv/feclearexcept.c b/newlib/libm/fenv/feclearexcept.c new file mode 100644 index 000000000..534da63d3 --- /dev/null +++ b/newlib/libm/fenv/feclearexcept.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill >---clear floating-point exception + +INDEX + feclearexcept +SYNOPSIS + #include + int feclearexcept(int <[except]>); + + Link with -lm. + +DESCRIPTION +This method attempts to clear the floating-point exceptions specified +in <[except]>. + +RETURNS +If the <[except]> argument is zero or all requested exceptions were +successfully cleared, this method returns zero. Otherwise, a non-zero +value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +#include +#include + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feclearexcept(int excepts) +{ + return (excepts ? -ENOTSUP : 0); +} diff --git a/newlib/libm/fenv/fegetenv.c b/newlib/libm/fenv/fegetenv.c new file mode 100644 index 000000000..67ebb3f0d --- /dev/null +++ b/newlib/libm/fenv/fegetenv.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---get current floating-point environment + +INDEX + fegetenv + +SYNOPSIS + #include + int fegetenv(fenv_t *<[envp]>); + + Link with -lm. + +DESCRIPTION +This method attempts to return the floating-point environment +in the area specified by <[envp]>. + +RETURNS +If floating-point environment was successfully returned, then +this method returns zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fegetenv(fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fegetexceptflag.c b/newlib/libm/fenv/fegetexceptflag.c new file mode 100644 index 000000000..c2f854bb2 --- /dev/null +++ b/newlib/libm/fenv/fegetexceptflag.c @@ -0,0 +1,68 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---get floating-point status flags + +INDEX + fegetexceptflag + +SYNOPSIS + #include + int fegetexceptflag(fexcept_t *<[flagp]>, int <[excepts]>); + + Link with -lm. + +DESCRIPTION +This method attempts to store an implementation-defined representation +of the states of the floating-point status flags specified by <[excepts]> +in the memory pointed to by <[flagp]>. + +RETURNS +If the information was successfully returned, this method returns +zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fegetexceptflag(fexcept_t *flagp, int excepts) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fegetround.c b/newlib/libm/fenv/fegetround.c new file mode 100644 index 000000000..1a7c2fd34 --- /dev/null +++ b/newlib/libm/fenv/fegetround.c @@ -0,0 +1,66 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---get current rounding direction + +INDEX + fegetround +SYNOPSIS + #include + int fegetround(void); + + Link with -lm. + +DESCRIPTION +This method returns the current rounding direction. + +RETURNS +This method returns the rounding direction, corresponding to the value +of the respective rouding macro. If the current rounding direction cannot +be determined, then a negative value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fegetround(void) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/feholdexcept.c b/newlib/libm/fenv/feholdexcept.c new file mode 100644 index 000000000..7d066a7fb --- /dev/null +++ b/newlib/libm/fenv/feholdexcept.c @@ -0,0 +1,70 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---save current floating-point environment + +INDEX + feholdexcept + +SYNOPSIS + #include + int feholdexcept(fenv_t *<[envp]>); + + Link with -lm. + +DESCRIPTION +This method attempts to save the current floating-point environment +in the fenv_t instance pointed to by <[envp]>, clear the floating +point status flags, and then, if supported by the target architecture, +install a "non-stop" (e.g. continue on floating point exceptions) mode +for all floating-point exceptions. + +RETURNS +This method will return zero if the non-stop floating-point exception +handler was installed. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feholdexcept(fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fenv.tex b/newlib/libm/fenv/fenv.tex new file mode 100644 index 000000000..3b76003d3 --- /dev/null +++ b/newlib/libm/fenv/fenv.tex @@ -0,0 +1,45 @@ +@node Fenv +@chapter Floating-Point Environment (@file{fenv.h}) + +This chapter groups the methods used to manipulate the floating-point +status flags. Floating-point operations modify the floating-point +status flags to indicate abnormal result information. + +The implementation of these methods is architecture specific. + +@menu +* feclearexcept:: Clear floating-point exception +* fegetenv:: Get current floating-point environment +* fegetexceptflag:: Get floating-point status flags +* fegetround:: Get current rounding direction +* feholdexcept:: Save current floating-point environment +* feraiseexcept:: Raise floating-point exception +* fesetenv:: Set current floating-point environment +* fesetexceptflag:: Set floating-point status flags +* fesetround:: Set current rounding direction +* fetestexcept:: Test floating-point exception flags +* feupdateenv:: Update current floating-point environment +@end menu + +@page +@include fenv/feclearexcept.def +@page +@include fenv/fegetenv.def +@page +@include fenv/fegetexceptflag.def +@page +@include fenv/fegetround.def +@page +@include fenv/feholdexcept.def +@page +@include fenv/feraiseexcept.def +@page +@include fenv/fesetenv.def +@page +@include fenv/fesetexceptflag.def +@page +@include fenv/fesetround.def +@page +@include fenv/fetestexcept.def +@page +@include fenv/feupdateenv.def diff --git a/newlib/libm/fenv/feraiseexcept.c b/newlib/libm/fenv/feraiseexcept.c new file mode 100644 index 000000000..3f756589c --- /dev/null +++ b/newlib/libm/fenv/feraiseexcept.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---raise floating-point exception + +INDEX + feraiseexcept +SYNOPSIS + #include + int feraiseexcept(int <[excepts]>); + + Link with -lm. + +DESCRIPTION +This method attempts to raise the floating-point exceptions specified +in <[excepts]>. + +RETURNS +If the <[excepts]> argument is zero or all requested exceptions were +successfully raised, this method returns zero. Otherwise, a non-zero +value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feraiseexcept(int excepts) +{ + return (excepts ? -ENOTSUP : 0); +} diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c new file mode 100644 index 000000000..f2432e0fc --- /dev/null +++ b/newlib/libm/fenv/fesetenv.c @@ -0,0 +1,72 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---set current floating-point environment + +INDEX + fesetenv + +SYNOPSIS + #include + int fesetenv(const fenv_t *<[envp]>); + + Link with -lm. + +DESCRIPTION +This method attempts to establish the floating-point environment +pointed to by <[envp]>. The argument <[envp]> must point to a +floating-point environment obtained via <> or <> +or a floating-point environment macro such as <>. + +It only sets the states of the flags as recorded in its argument, and +does not actually raise the associated floating-point exceptions. + +RETURNS +If floating-point environment was successfully established, then +this method returns zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fesetenv(const fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fesetexceptflag.c b/newlib/libm/fenv/fesetexceptflag.c new file mode 100644 index 000000000..0e8ce1f5c --- /dev/null +++ b/newlib/libm/fenv/fesetexceptflag.c @@ -0,0 +1,73 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---set floating-point status flags + +INDEX + fesetexceptflag + +SYNOPSIS + #include + int fesetexceptflag(const fexcept_t *<[flagp]>, int <[excepts]>); + + Link with -lm. + +DESCRIPTION +This method attempts to set the floating-point status flags specified +by <[excepts]> to the states indicated by <[flagp]>. The argument +<[flagp]> must point to an fexcept_t instance obtained via calling +<> with at least the floating-point exceptions specified +by the argument <[excepts]>. + +This method does not raise any floating-point exceptions. It only +sets the state of the flags. + +RETURNS +If the information was successfully returned, this method returns +zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fesetexceptflag(const fexcept_t *flagp, int excepts) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fesetround.c b/newlib/libm/fenv/fesetround.c new file mode 100644 index 000000000..d07efe86d --- /dev/null +++ b/newlib/libm/fenv/fesetround.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---set current rounding direction + +INDEX + fesetround +SYNOPSIS + #include + int fesetround(int <[round]>); + + Link with -lm. + +DESCRIPTION +This method attempts to set the current rounding direction represented +by <[round]>. <[round]> must be the value of one of the +rounding-direction macros. + +RETURNS +If the rounding mode was successfully established, this method returns +zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fesetround(int round) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fetestexcept.c b/newlib/libm/fenv/fetestexcept.c new file mode 100644 index 000000000..d81fb3f6a --- /dev/null +++ b/newlib/libm/fenv/fetestexcept.c @@ -0,0 +1,68 @@ + +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---test floating-point exception flags + +INDEX + fetestexcept +SYNOPSIS + #include + int fetestexcept(int <[except]>); + + Link with -lm. + +DESCRIPTION +This method test the current floating-point exceptions to determine +which of those specified in <[except]> are currently set. + +RETURNS +This method returns the bitwise-inclusive OR of the floating point +exception macros which correspond to the currently set floating point +exceptions. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fetestexcept(int excepts) +{ + return 0; +} diff --git a/newlib/libm/fenv/feupdateenv.c b/newlib/libm/fenv/feupdateenv.c new file mode 100644 index 000000000..014440ba4 --- /dev/null +++ b/newlib/libm/fenv/feupdateenv.c @@ -0,0 +1,72 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---update current floating-point environment + +INDEX + feupdateenv + +SYNOPSIS + #include + int feupdateenv(const fenv_t *<[envp]>); + + Link with -lm. + +DESCRIPTION +This method attempts to save the currently raised floating point +exceptions in its automatic storage, install the floating point +environment specified by <[envp]>, and raise the saved floating +point exceptions. + +The argument <[envp]> must point to a floating-point environment +obtained via <> or <>. + +RETURNS +If all actions are completed successfully, then this method returns zero. +Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feupdateenv(const fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/libm.in.xml b/newlib/libm/libm.in.xml index dea8a0f6c..f60030478 100644 --- a/newlib/libm/libm.in.xml +++ b/newlib/libm/libm.in.xml @@ -7,6 +7,7 @@ + diff --git a/newlib/libm/libm.texinfo b/newlib/libm/libm.texinfo index a579a1743..779615d32 100644 --- a/newlib/libm/libm.texinfo +++ b/newlib/libm/libm.texinfo @@ -94,6 +94,7 @@ into another language, under the above conditions for modified versions. @menu * Math:: The mathematical functions (`math.h'). * Complex:: The mathematical complex functions (`complex.h'). +* Fenv:: The floating point environment functions ('fenv.h'). * Reentrancy:: The functions in libm are not reentrant by default. * Long Double Functions:: The long double function support of libm. * Document Index:: diff --git a/newlib/libm/machine/aarch64/Makefile.in b/newlib/libm/machine/aarch64/Makefile.in index d31237e0f..ac85b3fef 100644 --- a/newlib/libm/machine/aarch64/Makefile.in +++ b/newlib/libm/machine/aarch64/Makefile.in @@ -52,9 +52,10 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(srcdir)/../../../Makefile.shared $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(srcdir)/../../../../mkinstalldirs +DIST_COMMON = $(srcdir)/../../../Makefile.shared INSTALL \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/../../../../mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \ diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 65a905c32..a2e3676fc 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -189,8 +189,8 @@ public: stack_t altstack; siginfo_t *sigwait_info; HANDLE signal_arrived; - HANDLE signalfd_select_wait; bool will_wait_for_signal; + long __align; /* Needed to align context to 16 byte. */ /* context MUST be aligned to 16 byte, otherwise RtlCaptureContext fails. If you prepend cygtls members here, make sure context stays 16 byte aligned. */ diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 1765f43b5..848f9bd68 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1469,14 +1469,6 @@ sigpacket::process () if (issig_wait) { tls->sigwait_mask = 0; - /* If the catching thread is running select on a signalfd, don't call - the signal handler and don't remove the signal from the queue. */ - if (tls->signalfd_select_wait) - { - SetEvent (tls->signalfd_select_wait); - rc = 0; - goto done; - } goto dosig; } diff --git a/winsup/cygwin/fenv.cc b/winsup/cygwin/fenv.cc index ebd93e8b4..69304b513 100644 --- a/winsup/cygwin/fenv.cc +++ b/winsup/cygwin/fenv.cc @@ -37,11 +37,9 @@ details. */ #define FE_SSE_EXCEPT_MASK_SHIFT (7) /* These are writable so we can initialise them at startup. */ -static fenv_t fe_dfl_env; static fenv_t fe_nomask_env; /* These pointers provide the outside world with read-only access to them. */ -const fenv_t *_fe_dfl_env = &fe_dfl_env; const fenv_t *_fe_nomask_env = &fe_nomask_env; /* Although Cygwin assumes i686 or above (hence SSE available) these @@ -435,6 +433,7 @@ void _feinitialise (void) { unsigned int edx, eax; + extern fenv_t __fe_dfl_env; /* Check for presence of SSE: invoke CPUID #1, check EDX bit 25. */ eax = 1; @@ -462,6 +461,6 @@ _feinitialise (void) fedisableexcept (FE_ALL_EXCEPT); /* Finally cache state as default environment. */ - fegetenv (&fe_dfl_env); + fegetenv (&__fe_dfl_env); } diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index e3656a33a..67638055e 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -168,8 +168,12 @@ fhandler_console::set_unit () if (created) con.owner = getpid (); } - if (!created && shared_console_info && kill (con.owner, 0) == -1) - con.owner = getpid (); + if (!created && shared_console_info) + { + pinfo p (con.owner); + if (!p) + con.owner = getpid (); + } dev ().parse (devset); if (devset != FH_ERROR) @@ -304,6 +308,9 @@ void fhandler_console::set_cursor_maybe () { con.fillin (get_output_handle ()); + /* Nothing to do for xterm compatible mode. */ + if (wincap.has_con_24bit_colors ()) + return; if (con.dwLastCursorPosition.X != con.b.dwCursorPosition.X || con.dwLastCursorPosition.Y != con.b.dwCursorPosition.Y) { @@ -312,6 +319,25 @@ fhandler_console::set_cursor_maybe () } } +/* Workaround for a bug of windows xterm compatible mode. */ +/* The horizontal tab positions are broken after resize. */ +static void +fix_tab_position (HANDLE h, SHORT width) +{ + char buf[2048] = {0,}; + /* Save cursor position */ + __small_sprintf (buf+strlen (buf), "\0337"); + /* Clear all horizontal tabs */ + __small_sprintf (buf+strlen (buf), "\033[3g"); + /* Set horizontal tabs */ + for (int col=8; colkill_pgrp (SIGWINCH); return true; } @@ -1589,6 +1617,12 @@ static const wchar_t __vt100_conv[31] = { inline bool fhandler_console::write_console (PWCHAR buf, DWORD len, DWORD& done) { + bool need_fix_tab_position = false; + /* Check if screen will be alternated. */ + if (wincap.has_con_24bit_colors () + && memmem (buf, len*sizeof (WCHAR), L"\033[?1049", 7*sizeof (WCHAR))) + need_fix_tab_position = true; + if (con.iso_2022_G1 ? con.vt100_graphics_mode_G1 : con.vt100_graphics_mode_G0) @@ -1607,6 +1641,9 @@ bool fhandler_console::write_console (PWCHAR buf, DWORD len, DWORD& done) len -= done; buf += done; } + /* Call fix_tab_position() if screen has been alternated. */ + if (need_fix_tab_position) + fix_tab_position (get_output_handle (), con.dwWinSize.X); return true; } diff --git a/winsup/cygwin/math/acosh.def.h b/winsup/cygwin/math/acosh.def.h index 1fc5deb14..870be3646 100644 --- a/winsup/cygwin/math/acosh.def.h +++ b/winsup/cygwin/math/acosh.def.h @@ -50,7 +50,12 @@ __FLT_TYPE __FLT_ABI(acosh) (__FLT_TYPE x) { int x_class = fpclassify (x); - if (x_class == FP_NAN || x < __FLT_CST(1.0)) + if (x_class == FP_NAN) + { + errno = EDOM; + return x; + } + else if (x < __FLT_CST(1.0)) { errno = EDOM; return __FLT_NAN; diff --git a/winsup/cygwin/math/coshl.c b/winsup/cygwin/math/coshl.c index d7eb4b7cb..e63699625 100644 --- a/winsup/cygwin/math/coshl.c +++ b/winsup/cygwin/math/coshl.c @@ -21,7 +21,7 @@ long double coshl(long double x) else if (x_class == FP_INFINITE) { errno = ERANGE; - return x; + return INFINITY; } x = fabsl (x); if (x > (MAXLOGL + LOGE2L)) diff --git a/winsup/cygwin/math/erfl.c b/winsup/cygwin/math/erfl.c index 3832fe9e0..bfd8d33d3 100644 --- a/winsup/cygwin/math/erfl.c +++ b/winsup/cygwin/math/erfl.c @@ -243,6 +243,9 @@ long double erfcl(long double a) if (isinf (a)) return (signbit(a) ? 2.0 : 0.0); + if (isnan (a)) + return (a); + x = fabsl (a); if (x < 1.0L) diff --git a/winsup/cygwin/math/lgammal.c b/winsup/cygwin/math/lgammal.c index 03c030e00..533ef7553 100644 --- a/winsup/cygwin/math/lgammal.c +++ b/winsup/cygwin/math/lgammal.c @@ -216,7 +216,7 @@ long double __lgammal_r(long double x, int* sgngaml) *sgngaml = 1; #ifdef NANS if (isnanl(x)) - return(NANL); + return x; #endif #ifdef INFINITIES if (!isfinitel(x)) diff --git a/winsup/cygwin/math/log.def.h b/winsup/cygwin/math/log.def.h index 2ba7421a2..b4121e929 100644 --- a/winsup/cygwin/math/log.def.h +++ b/winsup/cygwin/math/log.def.h @@ -56,6 +56,8 @@ __FLT_ABI(log) (__FLT_TYPE x) errno = ERANGE; return -__FLT_HUGE_VAL; } + else if (x_class == FP_NAN) + return x; else if (signbit (x)) { errno = EDOM; @@ -63,7 +65,5 @@ __FLT_ABI(log) (__FLT_TYPE x) } else if (x_class == FP_INFINITE) return __FLT_HUGE_VAL; - else if (x_class == FP_NAN) - return __FLT_NAN; return (__FLT_TYPE) __logl_internal ((long double) x); } diff --git a/winsup/cygwin/math/pow.def.h b/winsup/cygwin/math/pow.def.h index e1538d9fa..b004c0991 100644 --- a/winsup/cygwin/math/pow.def.h +++ b/winsup/cygwin/math/pow.def.h @@ -121,9 +121,13 @@ __FLT_ABI(pow) (__FLT_TYPE x, __FLT_TYPE y) return __FLT_CST(1.0); else if (x_class == FP_NAN || y_class == FP_NAN) { - rslt = (signbit(x) ? -__FLT_NAN : __FLT_NAN); - errno = EDOM; - return rslt; + if (x_class == FP_NAN) { + errno = EDOM; + return x; + } else { + errno = EDOM; + return y; + } } else if (x_class == FP_ZERO) { diff --git a/winsup/cygwin/math/tgammal.c b/winsup/cygwin/math/tgammal.c index 99408eed7..910706db6 100644 --- a/winsup/cygwin/math/tgammal.c +++ b/winsup/cygwin/math/tgammal.c @@ -272,7 +272,7 @@ long double __tgammal_r(long double x, int* sgngaml) *sgngaml = 1; #ifdef NANS if (isnanl(x)) - return (NANL); + return x; #endif #ifdef INFINITIES #ifdef NANS @@ -285,6 +285,9 @@ long double __tgammal_r(long double x, int* sgngaml) return (x); #endif #endif + if (x == 0.0L) + return copysignl(HUGE_VALL, x); + q = fabsl(x); if (q > 13.0L) @@ -299,8 +302,8 @@ long double __tgammal_r(long double x, int* sgngaml) gsing: _SET_ERRNO(EDOM); mtherr("tgammal", SING); -#ifdef INFINITIES - return (INFINITYL); +#ifdef NANS + return (NAN); #else return (*sgngaml * MAXNUML); #endif diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 9cf892801..ac73e0a88 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -1045,7 +1045,9 @@ peek_console (select_record *me, bool) else if (!PeekConsoleInputW (h, &irec, 1, &events_read) || !events_read) break; fh->acquire_input_mutex (INFINITE); - if (fhandler_console::input_winch == fh->process_input_message ()) + if (fhandler_console::input_winch == fh->process_input_message () + && global_sigs[SIGWINCH].sa_handler != SIG_IGN + && global_sigs[SIGWINCH].sa_handler != SIG_DFL) { set_sig_errno (EINTR); fh->release_input_mutex (); @@ -1847,80 +1849,6 @@ fhandler_windows::select_except (select_stuff *ss) return s; } -static int start_thread_signalfd (select_record *, select_stuff *); - -static DWORD WINAPI -thread_signalfd (void *arg) -{ - select_signalfd_info *si = (select_signalfd_info *) arg; - bool event = false; - - while (!event) - { - sigset_t set = 0; - _cygtls *tls = si->start->tls; - - for (select_record *s = si->start; (s = s->next); ) - if (s->startup == start_thread_signalfd) - set |= ((fhandler_signalfd *) s->fh)->get_sigset (); - set_signal_mask (tls->sigwait_mask, set); - tls->signalfd_select_wait = si->evt; - sig_dispatch_pending (true); - switch (WaitForSingleObject (si->evt, INFINITE)) - { - case WAIT_OBJECT_0: - tls->signalfd_select_wait = NULL; - event = true; - break; - default: - break; - } - if (si->stop_thread) - break; - if (!event) - Sleep (1L); - } - CloseHandle (si->evt); - return 0; -} - -static int -start_thread_signalfd (select_record *me, select_stuff *stuff) -{ - select_signalfd_info *si; - - if ((si = stuff->device_specific_signalfd)) - { - me->h = *si->thread; - return 1; - } - si = new select_signalfd_info; - si->start = &stuff->start; - si->stop_thread = false; - si->evt = CreateEventW (&sec_none_nih, TRUE, FALSE, NULL); - si->thread = new cygthread (thread_signalfd, si, "signalfdsel"); - me->h = *si->thread; - stuff->device_specific_signalfd = si; - return 1; -} - -static void -signalfd_cleanup (select_record *, select_stuff *stuff) -{ - select_signalfd_info *si; - - if (!(si = stuff->device_specific_signalfd)) - return; - if (si->thread) - { - si->stop_thread = true; - SetEvent (si->evt); - si->thread->detach (); - } - delete si; - stuff->device_specific_signalfd = NULL; -} - static int peek_signalfd (select_record *me, bool) { @@ -1940,17 +1868,19 @@ verify_signalfd (select_record *me, fd_set *rfds, fd_set *wfds, fd_set *efds) return peek_signalfd (me, true); } +extern HANDLE my_pendingsigs_evt; + select_record * fhandler_signalfd::select_read (select_stuff *stuff) { select_record *s = stuff->start.next; if (!s->startup) { - s->startup = start_thread_signalfd; + s->startup = no_startup; s->verify = verify_signalfd; - s->cleanup = signalfd_cleanup; } s->peek = peek_signalfd; + s->h = my_pendingsigs_evt; /* wait_sig sets this if signal are pending */ s->read_selected = true; s->read_ready = false; return s; diff --git a/winsup/cygwin/select.h b/winsup/cygwin/select.h index 19f9d7dc2..7d6dee753 100644 --- a/winsup/cygwin/select.h +++ b/winsup/cygwin/select.h @@ -71,12 +71,6 @@ struct select_serial_info: public select_info select_serial_info (): select_info () {} }; -struct select_signalfd_info: public select_info -{ - HANDLE evt; - select_signalfd_info (): select_info () {} -}; - class select_stuff { public: @@ -97,7 +91,6 @@ public: select_fifo_info *device_specific_fifo; select_socket_info *device_specific_socket; select_serial_info *device_specific_serial; - select_signalfd_info *device_specific_signalfd; bool test_and_set (int, fd_set *, fd_set *, fd_set *); int poll (fd_set *, fd_set *, fd_set *); @@ -110,8 +103,8 @@ public: device_specific_pipe (NULL), device_specific_fifo (NULL), device_specific_socket (NULL), - device_specific_serial (NULL), - device_specific_signalfd (NULL) {} + device_specific_serial (NULL) + {} }; extern "C" int cygwin_select (int , fd_set *, fd_set *, fd_set *, diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 920a533f3..8ac59d4b9 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -606,7 +606,6 @@ sigwait_common (const sigset_t *set, siginfo_t *info, PLARGE_INTEGER waittime) __try { set_signal_mask (_my_tls.sigwait_mask, *set); - _my_tls.signalfd_select_wait = NULL; sig_dispatch_pending (true); switch (cygwait (NULL, waittime, diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 8003e2db6..91abb717c 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -57,6 +57,9 @@ _cygtls NO_COPY *_sig_tls; Static HANDLE my_sendsig; Static HANDLE my_readsig; +/* Used in select if a signalfd is part of the read descriptor set */ +HANDLE NO_COPY my_pendingsigs_evt; + /* Function declarations */ static int __reg1 checkstate (waitq *); static __inline__ bool get_proc_lock (DWORD, DWORD); @@ -455,6 +458,10 @@ sigproc_init () } ProtectHandle (my_readsig); myself->sendsig = my_sendsig; + my_pendingsigs_evt = CreateEvent (NULL, TRUE, FALSE, NULL); + if (!my_pendingsigs_evt) + api_fatal ("couldn't create pending signal event, %E"); + /* sync_proc_subproc is used by proc_subproc. It serializes access to the children and proc arrays. */ sync_proc_subproc.init ("sync_proc_subproc"); @@ -1398,6 +1405,16 @@ wait_sig (VOID *) qnext->si.si_signo = 0; } } + /* At least one signal still queued? The event is used in select + only, and only to decide if WFMO should wake up in case a + signalfd is waiting via select/poll for being ready to read a + pending signal. This method wakes up all threads hanging in + select and having a signalfd, as soon as a pending signal is + available, but it's certainly better than constant polling. */ + if (sigq.start.next) + SetEvent (my_pendingsigs_evt); + else + ResetEvent (my_pendingsigs_evt); if (pack.si.si_signo == SIGCHLD) clearwait = true; } diff --git a/winsup/cygwin/tlsoffsets.h b/winsup/cygwin/tlsoffsets.h index 8003a1fff..13d1003e3 100644 --- a/winsup/cygwin/tlsoffsets.h +++ b/winsup/cygwin/tlsoffsets.h @@ -29,10 +29,10 @@ //; $tls::psigwait_info = 2852; //; $tls::signal_arrived = -9844; //; $tls::psignal_arrived = 2856; -//; $tls::signalfd_select_wait = -9840; -//; $tls::psignalfd_select_wait = 2860; -//; $tls::will_wait_for_signal = -9836; -//; $tls::pwill_wait_for_signal = 2864; +//; $tls::will_wait_for_signal = -9840; +//; $tls::pwill_wait_for_signal = 2860; +//; $tls::__align = -9836; +//; $tls::p__align = 2864; //; $tls::context = -9832; //; $tls::pcontext = 2868; //; $tls::thread_id = -9084; @@ -91,10 +91,10 @@ #define tls_psigwait_info (2852) #define tls_signal_arrived (-9844) #define tls_psignal_arrived (2856) -#define tls_signalfd_select_wait (-9840) -#define tls_psignalfd_select_wait (2860) -#define tls_will_wait_for_signal (-9836) -#define tls_pwill_wait_for_signal (2864) +#define tls_will_wait_for_signal (-9840) +#define tls_pwill_wait_for_signal (2860) +#define tls___align (-9836) +#define tls_p__align (2864) #define tls_context (-9832) #define tls_pcontext (2868) #define tls_thread_id (-9084) diff --git a/winsup/cygwin/tlsoffsets64.h b/winsup/cygwin/tlsoffsets64.h index 2e9d590c3..d137408d0 100644 --- a/winsup/cygwin/tlsoffsets64.h +++ b/winsup/cygwin/tlsoffsets64.h @@ -29,10 +29,10 @@ //; $tls::psigwait_info = 4144; //; $tls::signal_arrived = -8648; //; $tls::psignal_arrived = 4152; -//; $tls::signalfd_select_wait = -8640; -//; $tls::psignalfd_select_wait = 4160; -//; $tls::will_wait_for_signal = -8632; -//; $tls::pwill_wait_for_signal = 4168; +//; $tls::will_wait_for_signal = -8640; +//; $tls::pwill_wait_for_signal = 4160; +//; $tls::__align = -8632; +//; $tls::p__align = 4168; //; $tls::context = -8624; //; $tls::pcontext = 4176; //; $tls::thread_id = -7328; @@ -91,10 +91,10 @@ #define tls_psigwait_info (4144) #define tls_signal_arrived (-8648) #define tls_psignal_arrived (4152) -#define tls_signalfd_select_wait (-8640) -#define tls_psignalfd_select_wait (4160) -#define tls_will_wait_for_signal (-8632) -#define tls_pwill_wait_for_signal (4168) +#define tls_will_wait_for_signal (-8640) +#define tls_pwill_wait_for_signal (4160) +#define tls___align (-8632) +#define tls_p__align (4168) #define tls_context (-8624) #define tls_pcontext (4176) #define tls_thread_id (-7328) diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in index cebf39572..5bb62bc6f 100644 --- a/winsup/utils/Makefile.in +++ b/winsup/utils/Makefile.in @@ -101,7 +101,7 @@ cygpath.exe: CYGWIN_LDFLAGS += -lcygwin -luserenv -lntdll ps.exe: CYGWIN_LDFLAGS += -lcygwin -lpsapi -lntdll strace.exe: MINGW_LDFLAGS += -lntdll -ldd.exe:CYGWIN_LDFLAGS += -lpsapi +ldd.exe:CYGWIN_LDFLAGS += -lpsapi -lntdll pldd.exe: CYGWIN_LDFLAGS += -lpsapi minidumper.exe: CYGWIN_LDFLAGS += -ldbghelp diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc index bbc62f12f..a74054f4d 100644 --- a/winsup/utils/ldd.cc +++ b/winsup/utils/ldd.cc @@ -39,6 +39,7 @@ #define _WIN32_WINNT 0x0a00 #include +#include #include #include @@ -55,6 +56,7 @@ struct option longopts[] = const char *opts = "dhruvV"; static int process_file (const wchar_t *); +static void *drive_map; static int error (const char *fmt, ...) @@ -152,6 +154,32 @@ get_module_filename (HANDLE hp, HMODULE hm) return buf; } +static BOOL +GetFileNameFromHandle(HANDLE hFile, WCHAR pszFilename[MAX_PATH+1]) +{ + BOOL result = FALSE; + ULONG len = 0; + OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) alloca (65536); + NTSTATUS status = NtQueryObject (hFile, ObjectNameInformation, + ntfn, 65536, &len); + if (NT_SUCCESS (status)) + { + PWCHAR win32path = ntfn->Name.Buffer; + win32path[ntfn->Name.Length / sizeof (WCHAR)] = L'\0'; + + /* NtQueryObject returns a native NT path. (Try to) convert to Win32. */ + if (!drive_map) + drive_map = (void *) cygwin_internal (CW_ALLOC_DRIVE_MAP); + if (drive_map) + win32path = (PWCHAR) cygwin_internal (CW_MAP_DRIVE_MAP, drive_map, + win32path); + pszFilename[0] = L'\0'; + wcsncat (pszFilename, win32path, MAX_PATH); + result = TRUE; + } + return result; +} + static wchar_t * load_dll (const wchar_t *fn) { @@ -215,6 +243,7 @@ start_process (const wchar_t *fn, bool& isdll) struct dlls { LPVOID lpBaseOfDll; + HANDLE hFile; struct dlls *next; }; @@ -256,7 +285,17 @@ print_dlls (dlls *dll, const wchar_t *dllfn, const wchar_t *process_fn) char *fn; wchar_t *fullpath = get_module_filename (hProcess, (HMODULE) dll->lpBaseOfDll); if (!fullpath) - fn = strdup ("???"); + { + // if no path found yet, try getting it from an open handle to the DLL + wchar_t dllname[MAX_PATH+1]; + if (GetFileNameFromHandle (dll->hFile, dllname)) + { + fn = tocyg (dllname); + saw_file (basename (fn)); + } + else + fn = strdup ("???"); + } else if (dllfn && wcscmp (fullpath, dllfn) == 0) { free (fullpath); @@ -340,6 +379,7 @@ report (const char *in_fn, bool multiple) case LOAD_DLL_DEBUG_EVENT: dll_last->next = (dlls *) malloc (sizeof (dlls)); dll_last->next->lpBaseOfDll = ev.u.LoadDll.lpBaseOfDll; + dll_last->next->hFile = ev.u.LoadDll.hFile; dll_last->next->next = NULL; dll_last = dll_last->next; break; @@ -423,6 +463,8 @@ main (int argc, char **argv) while ((fn = *argv++)) if (report (fn, multiple)) ret = 1; + if (drive_map) + cygwin_internal (CW_FREE_DRIVE_MAP, drive_map); exit (ret); } diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index 75a91f5be..2307f7955 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -266,8 +266,8 @@ main (int argc, char *argv[]) (PVOID) &stodi, sizeof stodi, NULL); if (!NT_SUCCESS (status)) fprintf (stderr, - "NtQuerySystemInformation(SystemTimeOfDayInformation), " - "status %#010x\n", status); + "NtQuerySystemInformation(SystemTimeOfDayInformation), " + "status %#010x\n", (unsigned int) status); boot_time = to_time_t ((FILETIME*)&stodi.BootTime); }