Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-13libgloss/newlib: rename configure.in to configure.acMike Frysinger
The .in name has been deprecated for a long time in favor of .ac.
2021-09-08Cygwin: fix initializing MEM_EXTENDED_PARAMETER, take 2Corinna Vinschen
In https://cygwin.com/pipermail/cygwin/2021-September/249361.html Brian pointed out that initializing the structure would be more future proof, should the developers at Microsoft ever decide to split the Reserved field and use some bits of the struct for other purposes. Fixes: 3d322ac930ca ("Cygwin: fix initializing MEM_EXTENDED_PARAMETER") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-09-07Cygwin: pty: Fix error handling of master write().Takashi Yano
- Currently, error handling of write() in pty master side is broken. This patch fixes that.
2021-09-06nano-malloc: Fix redefined compilation warningTorbjorn SVENSSON via Newlib
When newlib is configured with --enable-newlib-reent-check-verify, the assert macro is already defined in the nano-mallocr.c compile unit. Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
2021-09-06Cygwin: fix initializing MEM_EXTENDED_PARAMETERCorinna Vinschen
MEM_EXTENDED_PARAMETER consists of a 64 bit bitfield which contains the Type and the Reserved members. The former usage of designated initializer lists initialized Type, but not Reserved. Since that's not possible anymore due to a g++ 11.2 bug, Cygwin initializes the MEM_EXTENDED_PARAMETER structs explicitely. This results in a random value in Reserved, which at least VirtualAlloc2 chokes on (ERROR_INVALID_PARAMETER). Set Reserved explicitely to 0 for a fix. Fixes: bdb7991db38b ("Cygwin: workaround a g++ 11.2 initialization bug") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-09-03Cygwin: fix declaration of RtlInitEmptyUnicodeStringCorinna Vinschen
This avoids "-Werror=maybe-uninitialized" errors due to using WCSTR accidentally. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-09-03ldexp/ldexpf: avoid assembler warningCorinna Vinschen
libm/machine/i386/f_ldexp.S:30: Warning: no instruction mnemonic suffix given and no register operands; using default for `fild' libm/machine/i386/f_ldexpf.S:30: Warning: no instruction mnemonic suffix given and no register operands; using default for `fild' fix this by adding the l mnemonic suffix Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-09-03strstr: avoid warningsCorinna Vinschen
unused function warning for two_way_short_needle, different char type warnings for standard string functions Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-09-03nftw: fix thread cancellation supportCorinna Vinschen
_STDIO_WITH_THREAD_CANCELLATION_SUPPORT was never defined. Include ../stdio/local.h to get the right definition per target. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-09-03Cygwin: testsuite: avoid "conflicting types" gcc warningCorinna Vinschen
With gcc 11.2: test.h:50:5: warning: conflicting types for built-in function ‘execve’; expected ‘int(const char *, char * const*)’ [-Wbuiltin-declaration-mismatch] test.h:51:5: warning: conflicting types for built-in function ‘execv’; expected ‘int(const char *, char * const*)’ [-Wbuiltin-declaration-mismatch] test.h:52:5: warning: conflicting types for built-in function ‘execvp’; expected ‘int(const char *, char * const*)’ [-Wbuiltin-declaration-mismatch] Fix prototypes accordingly. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-30Cygwin: dup: fix handle inheritence for disk file pread/pwrite handleCorinna Vinschen
The handle is created non-inheritable but gets inheritable when dup'ing the file descriptor. Fix that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-27libc/include/sys/signal.h: Change __STDINT_EXP() to __SIZEOF_INT__Joel Sherrill
__STDINT_EXP() is provided by newlib but not by stdint-gcc.h. stdint-gcc.h is used when the GCC argument -ffreestanding is used and this results in this file not compiling.
2021-08-27Cygwin: loader script: add DWARF 5 sectionsCorinna Vinschen
Modern gcc's generate additional DWARF 5 debug sections, which were still missing in our Cygwin loader script. With ld from binutils 2.37, this results in diagnostic output when linking the Cygwin DLL... ld: cygwin0.dll:/4: section below image base ld: cygwin0.dll:/20: section below image base ld: cygwin0.dll:/36: section below image base ...and the section addresses given to these sections (.debug_loclists, .debug_rnglists, debug_line_str) will be wrong. Fix this by adding the missing DWARF 5 sections to our linker script template cygwin.sc.in. Add a comment in terms of the deprecated DWARF 4 section .debug_types. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2021-08-26Cygwin: Allow using CFLAGS also for C++ filesCorinna Vinschen
This was used before switching to automake to allow easy tweaking of optimization and debugging settings from the command line during testing. Reenable. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26Cygwin: workaround a g++ 11.2 initialization bugCorinna Vinschen
trying to use aggregate initialization syntax on a member of a nameless union member failes in g++ 11.2. Workaround this by using explicit initialization. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26Cygwin: dumper: fix up GCC pragma for g++ 11.2Corinna Vinschen
The GCC diagnostic ignored "-Wstringop-overflow" pragma doesn't work as expected anymore. Use the still working expression. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26Cygwin: C++17: register keyword is deprecatedCorinna Vinschen
The register keyword was already deprecated with C++11, but with C++17 it has been entirely removed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-25nvptx: Emulate clock and other machine stubs.Roger Sayle
This patch to the libc/machine/nvptx port of newlib implements an approximation of "clock" and provides some additional stub routines. These changes not only reduce the number of (link) failures in the GCC testsuite when targeting nvptx-none, but also allow the NIST scimark4 benchmark to compile and run without modification. newlib already contains support for backends to provide their own clock implementations via -DCLOCK_PROVIDED. That functionality is used here to return an approximate elapsed time based on the NVidia GPU's clock64 cycle counter. Although not great, this is better than the current behaviour of link error from the unresolved symbol _times_r. The other part of the patch is to add a small number of stub functions to nvptx's misc.c. Adding isatty, for example, resolves linking problems in libc from the dependency in __smakebuf_r, and the sync stub, for example, fixes the failure with GCC's testsuite/gfortran.dg/ISO_Fortran_binding_14.f90 [which simply tests that gfortran can call a/any C function]. newlib/ configure.host: Add -DCLOCK_PROVIDED to newlib_cflags on nvptx*. newlib/libc/machine/nvptx Makefile.am: Add clock.c to lib_a_SOURCES. clock.c: New source file to implement/approximate clock(). misc.c: Add stubs for fstat, isatty, open, sync and unlink.
2021-08-23fix race condition in List_insertAleksand Malikov
Revert mx parameter and mutex lock while operating the list. Mutex was removed with 94d24160 informing that: 'Use InterlockedCompareExchangePointer to ensure race safeness without using a mutex.' But it does not. Calling pthread_mutex_init and pthread_mutex_destroy from two or more threads occasionally leads to hang in pthread_mutex_destroy. To not change the behaviour of other cases where List_insert was called, List_insert_nolock is added.
2021-08-23stdlib: conditionalize locale usageCorinna Vinschen
_strtod_l as well as the gethex function both fetch the decimal point from the current LC_NUMERIC locale info. This pulls in _C_numeric_locale unconditionally even on targets not supporting locales at all. Another problem is that strtod.c and gdtoa-gethex.c are ELIX 1, while locale information in general isn't. This leads to potential build breakage on bare metal targets. Fix this by setting the decimal point to "." on all targets not defining __HAVE_LOCALE_INFO__. While at it, const'ify the entire local decimal point info in the affected functions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-19Cygwin: fhandler_procsys::readdir: fix NtQueryDirectoryObject usageCorinna Vinschen
As outlined in the previous patch, the non-atomicity of iterating over a directory in the NT namespace via NtQueryDirectoryObject one entry each, results in potential duplication of directory entries. Fix this for fhandler_procsys::readdir as well by fetching the entire dir inside fhandler_procsys::opendir, storing it in a buffer, and just return buffer content from fhandler_procsys::readdir. Fixes: 43f65cdd7dae ("fhandler_procsys.cc: New file.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-19Cygwin: fix all usages of NtQueryDirectoryObjectCorinna Vinschen
Due to reports on the Cygwin mailing list[1][2], it was uncovered that a NtOpenDirectoryObject/NtQueryDirectoryObject/NtClose sequence with NtQueryDirectoryObject iterating over the directory entries, one entry per invocation, is not running atomically. If new entries are inserted into the queried directory, other entries may be moved around and then accidentally show up twice while iterating. Change (almost) all NtQueryDirectoryObject invocations so that it gets a really big buffer (64K) and ideally fetches all entries at once. This appears to work atomically. "Almost" all, because fhandler_procsys::readdir can't be easily changed. [1] https://cygwin.com/pipermail/cygwin/2021-July/248998.html [2] https://cygwin.com/pipermail/cygwin/2021-August/249124.html Fixes: e9c8cb31930bd ("(format_proc_partitions): Revamp loop over existing harddisks by scanning the NT native \Device object directory and looking for Harddisk entries.") Fixes: a998dd7055766 ("Implement advisory file locking.") Fixes: 3b7cd74bfdf56 ("(winpids::enum_processes): Fetch Cygwin processes from listing of shared cygwin object dir in the native NT namespace.") Fixes: 0d6f2b0117aa7 ("syscalls.cc (sync_worker): Rewrite using native NT functions.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-19Cygwin: return better inode numbers for block device entries in /proc/sysCorinna Vinschen
Commit 3434d35a64736f0b77a12f61784c2caa33ac44cf fixed a problem when accessing block devices via their /proc/sys/Device entries. This changed the way stat info is generated for these devices, resulting in identical inode numbers for all block devices under /proc/sys/Device. This patch fixes that by faking a device number for these devices, just as before. Fixes: 3434d35a6473 ("Cygwin: Fix access to block devices below /proc/sys.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-18svfwscanf: Simplify _sungetwc_r to eliminate apparent buffer overflowKeith Packard
svfwscanf replaces getwc and ungetwc_r. The comments in the code talk about avoiding file operations, but they also need to bypass the mbtowc calls as svfwscanf operates on wchar_t, not multibyte data, which is a more important reason here; they would not work correctly otherwise. The ungetwc replacement has code which uses the 3 byte FILE _ubuf field, but if wchar_t is 32-bits, this field is not large enough to hold even one wchar_t value. Building in this mode generates warnings about array overflow: In file included from ../../newlib/libc/stdio/svfiwscanf.c:35: ../../newlib/libc/stdio/vfwscanf.c: In function '_sungetwc_r.isra': ../../newlib/libc/stdio/vfwscanf.c:316:12: warning: array subscript 4294967295 is above array bounds of 'unsigned char[3]' [-Warray-bounds] 316 | fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - sizeof (wchar_t)]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../../newlib/libc/stdio/stdio.h:46, from ../../newlib/libc/stdio/vfwscanf.c:82, from ../../newlib/libc/stdio/svfiwscanf.c:35: ../../newlib/libc/include/sys/reent.h:216:17: note: while referencing '_ubuf' 216 | unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ | ^~~~~ However, the vfwscanf code *never* ungets data before the start of the scanning operation, and *always* ungets data which matches the input at that point, so the code always hits the block which backs up over the input data and never hits the block which uses the _ubuf field. In addition, the svfwscanf code will always start with the unget buffer empty, so the ungetwc replacement never needs to support an unget buffer at all. Simplify the code by removing support for everything other than backing up over the input data, leaving the check to make sure it doesn't get underflowed in case the vfscanf code has a bug in it. Signed-off-by: Keith Packard <keithp@keithp.com>
2021-08-09libc: Added prototypes for new POSIX APIsMatt Joyce
Added function prototypes to newlib/libc/include/pthread.h for the following Issue 8 Standard APIs: pthread_cond_clockwait() pthread_mutex_clocklock() pthread_rwlock_clockrdlock() pthread_rwlock_clockwrlock()
2021-08-04RISC-V: Reliably initialize t0 in _times()Christoph Muellner
The current implementation does not reliably initialize t0 once. Additionally the initialization requires two calls to _gettimeofday(). Let's sacrifice a byte to keep the initialization status and reduce the maximum number of calls to _gettimeofday(). This has caused issues in an application that invokes clock(). The problematic situation is as follows: 1) The program calls clock() which calls _times(). 2) _gettimeofday(&t0, 0) puts 0 in t0.tv_usec (because less than 1 us has elapsed since the beginning of time). 3) _gettimeofday(&t, 0) puts 1 in t.tv_usec (since now more than 1 us has elapsed since the beginning of time). 4) That call to clock() returns 1 (the value from step 3 minus the value in step 2). 5) The program does a second call to clock(). 6) The code above still sees 0 in t0 so it tries to update t0 again and _gettimeofday(&t0, 0) puts 1 in t0.tv_usec. 7) The _gettimeofday(&t, 0) puts 1 in t.tv_usec (since less than 1us has elapsed since step 3). 8) clock() returns 0 (step 7 minus step 6) and indicates that time is moving backwards. Signed-off-by: Christoph Muellner <cmuellner@gcc.gnu.org>
2021-08-03Cygwin: More profiler format + small issue fixesMark Geisert
Make sure to cast to ulong all DWORD values displayed with format "%lu". More instances are fixed here than in either my earlier unused patch or Corinna's patch. I decided to use typedef..ulong for more compact code. Address jturney's reported small issues: - Remove explicit external ref for cygwin_internal() as it is already provided by <sys/cygwin.h>. - Leave intact ref for cygwin_dll_path[] as it is required by function(s) in path.cc that profiler uses. Added comment to that effect. - Delete existing main() wrapper. Rename main2() to main(). This because profiler is now a Cygwin program and doesn't need to dynamically load cygwin1.dll. - Documentation issues will be addressed in a separate xml patch. (I would have linked message-ids of Corinna's and Jon's messages for proper theading but I no longer have their original emails and the mail archives don't show msgids any more.)
2021-08-03Cygwin: Make gmondump conform to its doc + adjust docMark Geisert
The doc for gmondump says 1 or more FILENAME are expected, but 0 is handled. That's an oversight. Make invocation with 0 FILENAMEs print a one-line help message. Reword the beginning of profiler's description doc to clarify target's child processes are run but only optionally profiled.
2021-08-02libc: Fix compilation for new sig2str/str2sig implementationChristoph Muellner
A recent patch introduced new code for sig2str/str2sig. This code does not properly exclude code that requires SIGRTMIN/SIGRTMAX to be defined and triggers the following compile error: newlib/libc/signal/sig2str.c:199:8: error: 'SIGRTMIN' undeclared newlib/libc/signal/sig2str.c:200:29: error: 'SIGRTMAX' undeclared Let's add the missing guards. Fixes: 2b50ec0cd205 ("libc: Fix compilation for new sig2str/str2sig implementation") Signed-off-by: Christoph Muellner <cmuellner@gcc.gnu.org>
2021-08-02Cygwin: export new sig2str/str2sigCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-02Cygwin: clarify importance of new GNU-specifc APICorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-02libc: Added implementation for sig2str/str2sig.Matt Joyce
Added implementations for sig2str() and str2sig() in libc/signal in order to improve POSIX compliance. Added fucntion prototypes in libc/include/sys/signal.h.
2021-07-30Cygwin: Add winsymlinks:sysJon Turney
Add winsymlinks:sys, to explicitly select always using plain files with the system attribute containing a magic cookie to represent a symlink.
2021-07-30Cygwin: Rename WSYM_sysfile to WSYM_defaultJon Turney
Rename WSYM_sysfile to WSYM_default, since it selects more than just sysfile with magic cookie now.
2021-07-30Cygwin: add release msg for previous getaddrinfo patchCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-30Cygwin: getaddrinfo: return valid ai_socktype and ai_protocol valuesCorinna Vinschen
If a service is supported as TCP and UDP service, GetAddrInfo does not return two entries, one for TCP, one for UDP, as on Linux. Rather, it just returns a single entry with ai_socktype and ai_protocol set to 0. If the service only exists as TCP or UDP service, then ai->ai_socktype is set, but ai_protocol isn't. Fortunately we copy over the result from Windows into local storage anyway, so this patch adds code to fix up the fields neglected by Windows. In case ai_socktype as well as ai_protocol are 0, duplicate the entry with valid values for ai_socktype and ai_protocol. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: bump API minor and set DLL version to 3.3.0Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlockCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: pthread.h: clean namespaceCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: implement pthread_mutex_clocklockCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: implement pthread_cond_clockwaitCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: implement sem_clockwaitCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29Cygwin: semaphore.h: clean namespaceCorinna Vinschen
use underscored identifiers Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28Cygwin: utils: refresh tzmap.hCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28Cygwin: utils: tzmap-from-unicode.org: enforce sorting order for LANG=CCorinna Vinschen
Generating the tzmap.h file requires to use the default sorting order. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28Cygwin: Convert gmondump and profiler synopses to <cmdsynopsis>Jon Turney
Convert gmondump and profiler synopses to <cmdsynopsis>, since addition of these crossed with e6b667f1.
2021-07-28Cygwin: document getifaddrs fixesKen Brown
2021-07-28Cygwin: getifaddrs: don't return a zero IPv4 addressKen Brown
If an interface is disconnected, net.cc:get_ifs tries to fetch IPv4 addresses from the registry. If it fails, it currently returns pointers to sockaddr structs with zero address. Return a NULL pointer instead, to signal the caller of getifaddrs that we do not have a valid struct sockaddr. Partially addresses: https://cygwin.com/pipermail/cygwin/2021-July/248970.html
2021-07-28Cygwin: getifaddrs: fix address family for IPv6 netmasksKen Brown
The code in net.cc:get_ifs that sets the netmask omitted setting the address family in the IPv6 case. Fix this by setting it to AF_INET6. Partially addresses: https://cygwin.com/pipermail/cygwin/2021-July/248970.html
2021-07-28Remove unneccesary parenthesis around declaratorMaxim Blinov
riscv64-unknown-elf-g++-11.1.0 regression suite reports the following failures for $ make check-gcc-c++ RUNTESTFLAGS='dg.exp=Wstringop-overflow-6.C' ``` FAIL: g++.dg/warn/Wstringop-overflow-6.C -std=gnu++14 (test for excess errors) FAIL: g++.dg/warn/Wstringop-overflow-6.C -std=gnu++17 (test for excess errors) FAIL: g++.dg/warn/Wstringop-overflow-6.C -std=gnu++2a (test for excess errors) UNSUPPORTED: g++.dg/warn/Wstringop-overflow-6.C -std=gnu++98 ``` The "excess errors" being ``` output is In file included from /home/maxim/prj/riscv-upstream/install/riscv64-unknown-elf/include/wchar.h:6, from /home/maxim/prj/riscv-upstream/build/gcc-stage2/riscv64-unknown-elf/libstdc++-v3/include/cwchar:44, from /home/maxim/prj/riscv-upstream/build/gcc-stage2/riscv64-unknown-elf/libstdc++-v3/include/bits/postypes.h:40, from /home/maxim/prj/riscv-upstream/build/gcc-stage2/riscv64-unknown-elf/libstdc++-v3/include/iosfwd:40, from /home/maxim/prj/riscv-upstream/build/gcc-stage2/riscv64-unknown-elf/libstdc++-v3/include/ios:38, from /home/maxim/prj/riscv-upstream/build/gcc-stage2/riscv64-unknown-elf/libstdc++-v3/include/ostream:38, from /home/maxim/prj/riscv-upstream/build/gcc-stage2/riscv64-unknown-elf/libstdc++-v3/include/iostream:39, from /home/maxim/prj/riscv-upstream/gcc-11.1.0/gcc/testsuite/g++.dg/warn/Wstringop-overflow-6.C:6: /home/maxim/prj/riscv-upstream/install/riscv64-unknown-elf/include/sys/reent.h:685:11: warning: unnecessary parentheses in declaration of '_sig_func' [-Wparentheses] ```