]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
3 years agodoc: Various fixes to makedocbook for python3.8 topic/fifo github/topic/fifo
Jon Turney [Sat, 22 Aug 2020 16:15:24 +0000 (17:15 +0100)]
doc: Various fixes to makedocbook for python3.8

Also update shebang to explicitly use python3, since python2 is EOL and
(per PEP 0394) 'python' may not exist at all.

3 years agoCygwin: cwdstuff::get: clean up debug_printf output
Ken Brown [Sun, 23 Aug 2020 22:41:18 +0000 (18:41 -0400)]
Cygwin: cwdstuff::get: clean up debug_printf output

Set errno = 0 at the beginning so that the debug_printf call at the
end doesn't report a nonzero errno left over from some other function
call.

3 years agoCygwin: pty: Implement new pseudo console support.
Takashi Yano [Wed, 19 Aug 2020 11:25:21 +0000 (20:25 +0900)]
Cygwin: pty: Implement new pseudo console support.

- In this implementation, pseudo console is created for each native
  console app. Advantages and disadvantages of this implementation
  over the previous implementation are as follows.

  Advantages:
  1) No performance degradation in pty output for cygwin process.
      https://cygwin.com/pipermail/cygwin/2020-February/243858.html
  2) Free from the problem caused by difference of behaviour of control
     sequences between real terminal and pseudo console.
      https://cygwin.com/pipermail/cygwin/2019-December/243281.html
      https://cygwin.com/pipermail/cygwin/2020-February/243855.html
  3) Free from the problem in cgdb and emacs gud.
      https://cygwin.com/pipermail/cygwin/2020-January/243601.html
      https://cygwin.com/pipermail/cygwin/2020-March/244146.html
  4) Redrawing screen on executing native console apps is not necessary.
  5) cygwin-console-helper is not necessary for the pseudo console
     support.
  6) The codes for pseudo console support are much simpler than that
     of the previous one.

  Disadvantages:
  1) The cygwin program which calls console API directly does not work.
  2) The apps which use console API cannot be debugged with gdb. This
     is because pseudo console is not activated since gdb uses
     CreateProcess() rather than exec(). Even with this limitation,
     attaching gdb to native apps, in which pseudo console is already
     activated, works.
  3) Typeahead key inputs are discarded while native console app is
     executed. Simirally, typeahead key inputs while cygwin app is
     executed are not inherited to native console app.
  4) Code page cannot be changed by chcp.com. Acctually, chcp works
     itself and changes code page of its own pseudo console.  However,
     since pseudo console is recreated for another process, it cannot
     inherit the code page.
  5) system_printf() does not work after stderr is closed. (Same with
     cygwin 3.0.7)
  6) Startup time of native console apps is about 3 times slower than
     previous implemenation.
  7) Pseudo console cannot be activated if it is already activated for
     another process on same pty.

3 years agoCygwin: bump version to 3.2.0
Corinna Vinschen [Sat, 22 Aug 2020 11:43:46 +0000 (13:43 +0200)]
Cygwin: bump version to 3.2.0

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: strace: ignore GCC exceptions cygwin-3_1_7-release
Ken Brown [Thu, 20 Aug 2020 13:47:47 +0000 (09:47 -0400)]
Cygwin: strace: ignore GCC exceptions

Any C++ app that calls 'throw' on 64-bit Cygwin results in an
exception of type STATUS_GCC_THROW (0x20474343) generated by the C++
runtime.  Don't pollute the strace output by printing information
about this and other GCC exceptions.

3 years agoCygwin: add header defining GCC exception codes
Ken Brown [Thu, 20 Aug 2020 14:35:43 +0000 (10:35 -0400)]
Cygwin: add header defining GCC exception codes

Include it in exceptions.cc instead of defining the exception codes
there.

3 years agoCygwin: main exception handler (64-bit): continue GCC exceptions
Ken Brown [Mon, 17 Aug 2020 20:24:59 +0000 (16:24 -0400)]
Cygwin: main exception handler (64-bit): continue GCC exceptions

This is necessary in order to be consistent with the following comment
in the definition of _Unwind_RaiseException() in the GCC source file
libgcc/unwind-seh.c:

     The exception handler installed in crt0 will continue any GCC
     exception that reaches there (and isn't marked non-continuable).

Previously we failed to do this and, as a consequence, the C++ runtime
didn't call std::terminate after an unhandled exception.

This fixes the problem reported here:

  https://cygwin.com/pipermail/cygwin/2019-October/242795.html
  https://sourceware.org/pipermail/cygwin/2020-August/245897.html

3 years agolibm/stdlib: Realloc when shrinking by 2* or more
Keith Packard via Newlib [Fri, 14 Aug 2020 00:19:02 +0000 (17:19 -0700)]
libm/stdlib: Realloc when shrinking by 2* or more

This reduces memory usage when reallocating objects much smaller.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/stdlib: don't read past source in nano_realloc
Keith Packard via Newlib [Fri, 14 Aug 2020 00:19:01 +0000 (17:19 -0700)]
libm/stdlib: don't read past source in nano_realloc

Save the computed block size and use it to avoid reading past
the end of the source block.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoCygwin: pty: Change the timing of set_locale() call again.
Takashi Yano via Cygwin-patches [Sat, 15 Aug 2020 03:23:52 +0000 (12:23 +0900)]
Cygwin: pty: Change the timing of set_locale() call again.

- After commit 095972ce5b1d319915501a7e381802914bed790c, charset
  conversion in mintty is broken if charset is set to other than
  UTF-8. This seems to be caused because mintty does not set locale
  yet at fork() call. This patch changes the timing of set_locale()
  call again to avoid this issue.

3 years agoCygwin: pty: Change the timing of setup_locale() call.
Takashi Yano via Cygwin-patches [Thu, 13 Aug 2020 05:42:20 +0000 (14:42 +0900)]
Cygwin: pty: Change the timing of setup_locale() call.

- If native app is exec()'ed in a new pty, setup_locale() loses the
  chance to be called. For example, with "mintty -e cmd", charset
  conversion does not work as expected. This patch fixes the issue.

3 years agolibc/stdlib: Fix build failure in nano_calloc
Craig Blackmore [Wed, 12 Aug 2020 14:33:23 +0000 (15:33 +0100)]
libc/stdlib: Fix build failure in nano_calloc

commit 588a5e1ddebdf6d74391c7409680ea20e050c0e1 added a non-reentrant
call to nano_malloc which causes a build failure if INTERNAL_NEWLIB is
defined.

Here is a snippet of the error:

In file included from .../newlib/newlib/libc/stdlib/nano-mallocr.c:38:
.../newlib/newlib/libc/include/malloc.h:42:25: note: expected 'struct _reent *' but argument is of type 'ptrdiff_t' {aka 'int'}
   42 | extern void *_malloc_r (struct _reent *, size_t);
      |                         ^~~~~~~~~~~~~~~
.../newlib/newlib/libc/stdlib/nano-mallocr.c:67:22: error: too few arguments to function '_malloc_r'
   67 | #define nano_malloc  _malloc_r
      |                      ^~~~~~~~~
.../newlib/newlib/libc/stdlib/nano-mallocr.c:456:11: note: in expansion of macro 'nano_malloc'
  456 |     mem = nano_malloc(bytes);
      |           ^~~~~~~~~~~
In file included from .../newlib/newlib/libc/stdlib/nano-mallocr.c:38:
.../newlib/newlib/libc/include/malloc.h:42:14: note: declared here
   42 | extern void *_malloc_r (struct _reent *, size_t);
      |              ^~~~~~~~~
.../newlib/newlib/libc/stdlib/nano-mallocr.c:43: warning: "assert" redefined
   43 | #define assert(x) ((void)0)
      |

This patch adds a missing RCALL to the args when calling nano_malloc
from nano_calloc, so that if the call is reentrant, reent_ptr is passed
as the first argument.

The variable `bytes` (also added in 588a5e1d) has been changed from a
`ptrdiff_t` to `malloc_size_t` as it does not need to be signed. It is
used to store the product of two unsigned malloc_size_t variables and
then iff there was no overflow is it passed to malloc and memset which
both expect size_t which is unsigned.

Signed-off-by: Craig Blackmore <craig.blackmore@embecosm.com>
3 years agolibc/stdlib: Use __builtin_mul_overflow for reallocarray and calloc
Keith Packard via Newlib [Tue, 11 Aug 2020 23:05:40 +0000 (16:05 -0700)]
libc/stdlib: Use __builtin_mul_overflow for reallocarray and calloc

This built-in function (available in both gcc and clang) is more
efficient and generates shorter code than open-coding the test.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/machine/riscv: Add custom fma/sqrt functions when supported [v2]
Keith Packard via Newlib [Wed, 12 Aug 2020 02:47:17 +0000 (19:47 -0700)]
libm/machine/riscv: Add custom fma/sqrt functions when supported [v2]

Check for HW FMA and SQRT support and use those instructions in place
of software implementations.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoCygwin: pty: Add a workaround for issue of starting a lot of mintty.
Takashi Yano [Tue, 11 Aug 2020 04:16:52 +0000 (13:16 +0900)]
Cygwin: pty: Add a workaround for issue of starting a lot of mintty.

- If a lot of mintty are started in a short time from a mintty, some
  of them hang with empty screen, crash immediately or hang on exiting
  mintty. The following report seems to be related to this issue.
    https://cygwin.com/pipermail/cygwin/2020-August/245751.html
  The cause is not clear at all, but this patch seems to solve the
  issue.

3 years agolibm/machine/arm: Add optimized fmaf and fma when available
Keith Packard via Newlib [Sat, 8 Aug 2020 22:34:13 +0000 (15:34 -0700)]
libm/machine/arm: Add optimized fmaf and fma when available

When HAVE_FAST_FMAF is set, use the vfma.f32 instruction, when
HAVE_FAST_FMA is set, use the vfma.f64 instruction.

Usually the compiler built-ins will already have inlined these
instructions, but provide these symbols for cases where that doesn't
work instead of falling back to the (inaccurate) common code versions.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm: Detect fast fmaf support
Keith Packard via Newlib [Sat, 8 Aug 2020 22:34:12 +0000 (15:34 -0700)]
libm: Detect fast fmaf support

Anything with fast FMA is assumed to have fast FMAF, along with
32-bit arms that advertise 32-bit FP support and __ARM_FEATURE_FMA

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm: ARM without HW double does not have fast FMA
Keith Packard via Newlib [Sat, 8 Aug 2020 22:34:11 +0000 (15:34 -0700)]
libm: ARM without HW double does not have fast FMA

32-bit ARM processors with HW float (but not HW double) may define
__ARM_FEATURE_FMA, but that only means they have fast FMA for 32-bit
floats.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/math: ensure that expf(-huge) sets FE_UNDERFLOW exception
Keith Packard via Newlib [Sat, 8 Aug 2020 05:40:21 +0000 (22:40 -0700)]
libm/math: ensure that expf(-huge) sets FE_UNDERFLOW exception

It was calling __math_uflow(0) instead of __math_uflowf(0), which
resulted in no exception being set on machines with exception support
for float but not double.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoCygwin: cygserver: build with -Wimplicit-fallthrough=5
Ken Brown [Fri, 7 Aug 2020 13:48:28 +0000 (09:48 -0400)]
Cygwin: cygserver: build with -Wimplicit-fallthrough=5

Define the pseudo keyword 'fallthrough' in woutsup.h to support this.

3 years agoCygwin: Use documented QueryWorkingSetEx() in dumper
Jon Turney [Wed, 29 Jul 2020 14:19:13 +0000 (15:19 +0100)]
Cygwin: Use documented QueryWorkingSetEx() in dumper

In dumper, use the documented QueryWorkingSetEx(), rather than the
undocumented NtQueryVirtualMemory() with MemoryWorkingSetExInformation.

3 years agoMSP430: Increase the amount of main memory available in sim ld scripts
Jozef Lawrynowicz [Fri, 7 Aug 2020 10:49:54 +0000 (11:49 +0100)]
MSP430: Increase the amount of main memory available in sim ld scripts

The main memory region of the GDB simulator ends at address 0xFFBF,
but the simulator linker scripts do not make full use of this available
memory.

>From 61f3d212741acee583e21ff2c2808775584ecad6 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Mon, 3 Aug 2020 19:38:23 +0100
Subject: [PATCH 2/2] MSP430: Increase the amount of main memory available in
 sim ld scripts

The main memory region of the GDB simulator ends at address 0xFFBF,
but the simulator linker scripts do not make full use of this available
memory.

3 years agoMSP430: Word align __*_array_start symbols in sim linker scripts
Jozef Lawrynowicz [Fri, 7 Aug 2020 10:48:27 +0000 (11:48 +0100)]
MSP430: Word align __*_array_start symbols in sim linker scripts

__{preinit,init,fini}_array_start symbols must be word aligned in
linker scripts. If the section preceding the __*_array_start symbol
has an odd size, then a NULL byte will be present between the start
symbol and the .*_array section itself, when the section gets
automatically word-aligned.

This results in a branch to an invalid address when the CRT startup
code tries to run through the functions listed in the array sections.

>From de115144d05ecbaa82c9c737cc261715ca4b7d67 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Mon, 3 Aug 2020 19:09:46 +0100
Subject: [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim linker
 scripts

__{preinit,init,fini}_array_start symbols must be word aligned in
linker scripts. If the section preceding the __*_array_start symbol
has an odd size, then a NULL byte will be present between the start
symbol and the .*_array section itself, when the section gets
automatically word-aligned.

This results in a branch to an invalid address when the CRT startup
code tries to run through the functions listed in the array sections.

3 years agoCygwin: cygserver: build with -Wimplicit-fallthrough=4 -Werror
Corinna Vinschen [Fri, 7 Aug 2020 10:33:38 +0000 (12:33 +0200)]
Cygwin: cygserver: build with -Wimplicit-fallthrough=4 -Werror

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: build with -Wimplicit-fallthrough=4 -Werror
Corinna Vinschen [Fri, 7 Aug 2020 11:31:38 +0000 (13:31 +0200)]
Cygwin: utils: build with -Wimplicit-fallthrough=4 -Werror

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: convert usage() to proper noreturn function throughout
Corinna Vinschen [Fri, 7 Aug 2020 11:29:43 +0000 (13:29 +0200)]
Cygwin: utils: convert usage() to proper noreturn function throughout

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: cygcheck: avoid GCC warning concatenating strings
Corinna Vinschen [Fri, 7 Aug 2020 11:30:40 +0000 (13:30 +0200)]
Cygwin: utils: cygcheck: avoid GCC warning concatenating strings

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: utils: refresh tzmap
Corinna Vinschen [Fri, 7 Aug 2020 10:09:02 +0000 (12:09 +0200)]
Cygwin: utils: refresh tzmap

- update path to Unicode windowsZones.xml file
- drop Windows XP considerations
- regenerate tzmap.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agolibm: Control errno support with _IEEE_LIBM configuration parameter
Keith Packard via Newlib [Tue, 4 Aug 2020 22:22:24 +0000 (15:22 -0700)]
libm: Control errno support with _IEEE_LIBM configuration parameter

This removes the run-time configuration of errno support present in
portions of the math library and unifies all of the compile-time errno
configuration under a single parameter so that the whole library
is consistent.

The run-time support provided by _LIB_VERSION is no longer present in
the public API, although it is still used internally to disable errno
setting in some functions. Now that it is a constant, the compiler should
remove that code when errno is not supported.

This removes s_lib_ver.c as _LIB_VERSION is no longer variable.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/math: Don't modify __ieee754_pow return values in pow
Keith Packard via Newlib [Tue, 4 Aug 2020 22:22:23 +0000 (15:22 -0700)]
libm/math: Don't modify __ieee754_pow return values in pow

The __ieee754 functions already return the right value in exception
cases, so don't modify those. Setting the library to _POSIX_/_IEEE_
mode now only affects whether errno is modified.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/math: Set errno to ERANGE for pow(0, -y)
Keith Packard via Newlib [Tue, 4 Aug 2020 22:22:22 +0000 (15:22 -0700)]
libm/math: Set errno to ERANGE for pow(0, -y)

POSIX says that the errno for pow(0, -y) should be ERANGE instead of
EDOM.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/pow.html

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/math: Make yx functions set errno=ERANGE for x=0
Keith Packard via Newlib [Tue, 4 Aug 2020 22:22:21 +0000 (15:22 -0700)]
libm/math: Make yx functions set errno=ERANGE for x=0

The y0, y1 and yn functions need separate conditions when x is zero as
that returns ERANGE instead of EDOM.

Also stop adjusting the return value from the __ieee754_y* functions
as that is already correct and we were just breaking it.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/math: set errno to ERANGE at gamma poles
Keith Packard via Newlib [Tue, 4 Aug 2020 22:22:20 +0000 (15:22 -0700)]
libm/math: set errno to ERANGE at gamma poles

For POSIX, gamma(i) (i non-positive integer) should set errno to
ERANGE instead of EDOM.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoCygwin: Add 'fallthrough' pseudo keyword for switch/case use
Corinna Vinschen [Wed, 5 Aug 2020 19:58:22 +0000 (21:58 +0200)]
Cygwin: Add 'fallthrough' pseudo keyword for switch/case use

This patch has been inspired by the Linux kernel patch

  294f69e662d1 compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use

written by Joe Perches <joe AT perches DOT com> based on an idea from
Dan Carpenter <dan DOT carpenter AT oracle DOT com>.  The following text
is from the original log message:

Reserve the pseudo keyword 'fallthrough' for the ability to convert the
various case block /* fallthrough */ style comments to appear to be an
actual reserved word with the same gcc case block missing fallthrough
warning capability.

All switch/case blocks now should end in one of:

break;
fallthrough;
goto <label>;
return [expression];
continue;

In C mode, GCC supports the __fallthrough__ attribute since 7.1,
the same time the warning and the comment parsing were introduced.

Cygwin-only: add an explicit -Wimplicit-fallthrough=5 to the build
flags.

3 years agoCygwin: Fix missing breaks in switch statement
Corinna Vinschen [Wed, 5 Aug 2020 19:46:53 +0000 (21:46 +0200)]
Cygwin: Fix missing breaks in switch statement

Two switch statements in sysconf() and
fhandler_fifo::take_ownership were missing breaks.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agolibm: Set math_errhandling to match library and hardware [v2]
Keith Packard via Newlib [Tue, 4 Aug 2020 15:04:39 +0000 (08:04 -0700)]
libm: Set math_errhandling to match library and hardware [v2]

math_errhandling is specified to contain two bits of information:

 1. MATH_ERRNO     -- Set when the library sets errno
 2. MATH_ERREXCEPT -- Set when math operations report exceptions

MATH_ERRNO should match whether the original math code is compiled in
_IEEE_LIBM mode and the new math code has WANT_ERRNO == 1.

MATH_ERREXCEPT should match whether the underlying hardware has
exception support. This patch adds configurations of this value for
RISC-V, ARM, Aarch64, x86 and x86_64 when using HW float.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/common: Set WANT_ERRNO based on _IEEE_LIBM value
Keith Packard via Newlib [Mon, 3 Aug 2020 17:55:03 +0000 (10:55 -0700)]
libm/common: Set WANT_ERRNO based on _IEEE_LIBM value

_IEEE_LIBM is the configuration value which controls whether the
original libm functions modify errno. Use that in the new math code as
well so that the resulting library is internally consistent.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoCygwin: FIFO: add a third pass to raw_read
Ken Brown [Mon, 3 Aug 2020 13:44:31 +0000 (09:44 -0400)]
Cygwin: FIFO: add a third pass to raw_read

Currently raw_read makes two passes through the list of clients.  On
the first pass it tries to read from the client from which it last
read successfully.  On the second pass it tries to read from all
connected clients.

Add a new pass in between these two, in which raw_read tries to read
from all clients that are in the fc_input_avail case.  This should be
more efficient in case select was previously called and detected input
available.

Slightly tweak the first pass.  If a client is marked as having the
last successful read but reading from it now finds no input, don't
unmark it unless we successfully read from a different client on one
of the later passes.

3 years agoCygwin: FIFO: fix indentation
Ken Brown [Mon, 3 Aug 2020 13:43:36 +0000 (09:43 -0400)]
Cygwin: FIFO: fix indentation

3 years agoCygwin: FIFO: synchronize the fifo_reader and fifosel threads
Ken Brown [Mon, 3 Aug 2020 13:38:08 +0000 (09:38 -0400)]
Cygwin: FIFO: synchronize the fifo_reader and fifosel threads

The fifo_reader thread function and the function select.cc:peek_fifo()
can both change the state of a fifo_client_handler.  These changes are
made under fifo_client_lock, so there is no race, but the changes can
still be incompatible.

Add code to make sure that only one of these functions can change the
state from its initial fc_listening state.  Whichever function does
this calls the fhandler_fifo::record_connection method, which is now
public so that peek_fifo can call it.

Slightly modify that method to make it suitable for being called by
peek_fifo.

Make a few other small changes to the fifo_reader thread function to
change how it deals with the STATUS_PIPE_CLOSING value that can
(rarely) be returned by NtFsControlFile.

Add commentary to fhandler_fifo.cc to explain fifo_client connect
states and where they can be changed.

3 years agoCygwin: FIFO: don't read from pipes that are closing
Ken Brown [Mon, 3 Aug 2020 13:35:00 +0000 (09:35 -0400)]
Cygwin: FIFO: don't read from pipes that are closing

Don't try to read from fifo_client_handlers that are in the fc_closing
state.  Experiments have shown that this always yields
STATUS_PIPE_BROKEN, so it just wastes a Windows system call.

Re-order the values in enum fifo_client_connect_state to reflect the
new status of fc_closing.

3 years agoCygwin: FIFO: reorganize some fifo_client_handler methods
Ken Brown [Mon, 3 Aug 2020 13:32:30 +0000 (09:32 -0400)]
Cygwin: FIFO: reorganize some fifo_client_handler methods

Rename the existing set_state() to query_and_set_state() to reflect
what it really does.  (It queries the O/S for the pipe state.)  Add a
new set_state() method, which is a standard setter, and a
corresponding getter get_state().

3 years agoCygwin: FIFO: add a timeout to take_ownership
Ken Brown [Mon, 3 Aug 2020 13:17:06 +0000 (09:17 -0400)]
Cygwin: FIFO: add a timeout to take_ownership

fhandler_fifo::take_ownership() is called from select.cc::peek_fifo
and fhandler_fifo::raw_read and could potentially block indefinitely
if something goes wrong.  This is always undesirable in peek_fifo, and
it is undesirable in a nonblocking read.  Fix this by adding a timeout
parameter to take_ownership.

Arbitrarily use a 1 ms timeout in peek_fifo and a 10 ms timeout in
raw_read.  These numbers may have to be tweaked based on experience.

Replace the call to cygwait in take_ownership by a call to WFSO.
There's no need to allow interruption now that we have a timeout.

3 years agoCygwin: FIFO: fix timing issue with owner change
Ken Brown [Sun, 2 Aug 2020 20:38:24 +0000 (16:38 -0400)]
Cygwin: FIFO: fix timing issue with owner change

fhandler_fifo::take_ownership() tacitly assumes that the current
owner's fifo_reader_thread will be woken up from WFMO when
update_needed_evt is signaled.  But it's possible that the the current
owner's fifo_reader_thread is at the beginning of its main loop rather
than in its WFMO call when that event is signaled.

In this case the owner will never see that the event has been
signaled, and it will never update the shared fifo_client_handlers.
The reader that wants to take ownership will then spin its wheels
forever.

Fix this by having the current owner call update_shared_handlers at
the beginning of its loop, if necessary.

3 years agoCygwin: FIFO: lock fixes
Ken Brown [Fri, 31 Jul 2020 17:55:17 +0000 (13:55 -0400)]
Cygwin: FIFO: lock fixes

Add some missing locks and remove one extra unlock.  Clarify for some
functions whether caller or callee acquires lock, and add appropriate
comments.

3 years agofhandler_proc.cc(format_proc_cpuinfo): use _small_sprintf %X for microcode
Brian Inglis [Tue, 4 Aug 2020 06:51:56 +0000 (00:51 -0600)]
fhandler_proc.cc(format_proc_cpuinfo): use _small_sprintf %X for microcode

microcode is unsigned long long, printed by _small_sprintf using %x;
Cygwin32 used last 4 bytes of microcode for next field MHz, printing 0;
use correct _small_sprintf format %X to print microcode, producing
correct MHz value under Cygwin32

3 years agofhandler_proc.cc(format_proc_cpuinfo): add SERIALIZE instruction flag
Brian Inglis [Mon, 3 Aug 2020 16:22:46 +0000 (10:22 -0600)]
fhandler_proc.cc(format_proc_cpuinfo): add SERIALIZE instruction flag

CPUID 7:0 EDX[14] serialize added in linux-next 5.8 by Ricardo Neri-Calderon:
The Intel architecture defines a set of Serializing Instructions (a
detailed definition can be found in Vol.3 Section 8.3 of the Intel "main"
manual, SDM). However, these instructions do more than what is required,
have side effects and/or may be rather invasive. Furthermore, some of
these instructions are only available in kernel mode or may cause VMExits.
Thus, software using these instructions only to serialize execution (as
defined in the manual) must handle the undesired side effects.

As indicated in the name, SERIALIZE is a new Intel architecture
Serializing Instruction. Crucially, it does not have any of the mentioned
side effects. Also, it does not cause VMExit and can be used in user mode.

This new instruction is currently documented in the latest "extensions"
manual (ISE). It will appear in the "main" manual in the future.

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/arch/x86/include/asm/cpufeatures.h?id=85b23fbc7d88f8c6e3951721802d7845bc39663d

3 years agolibm/math: Use __math_xflow in obsolete math code [v2]
Keith Packard [Thu, 30 Jul 2020 23:41:05 +0000 (16:41 -0700)]
libm/math: Use __math_xflow in obsolete math code [v2]

C compilers may fold const values at compile time, so expressions
which try to elicit underflow/overflow by performing simple
arithemetic on suitable values will not generate the required
exceptions.

Work around this by replacing code which does these arithmetic
operations with calls to the existing __math_xflow functions that are
designed to do this correctly.

Signed-off-by: Keith Packard <keithp@keithp.com>
----

v2:
libm/math: Pass sign to __math_xflow instead of muliplying result

3 years agoselect.h: update FD macros to latest FreeBSD, fix type conversion warning
Corinna Vinschen [Mon, 3 Aug 2020 10:40:43 +0000 (12:40 +0200)]
select.h: update FD macros to latest FreeBSD, fix type conversion warning

Compiling

#include <sys/select.h>
void f(int X)
{
  fd_set set;
  FD_ZERO(&set);
  FD_SET(X,&set);
  FD_CLR(X+1,&set);
  (void)FD_ISSET(X+2,&set);
}

results in plenty of gcc warnings when compiled with
-Wconversion -Wsign-conversion:

  fds.c:7:2: warning: conversion to â€˜long unsigned int’ from â€˜int’ may
  Â  FD_SET(X,&set);
  Â  ^~~~~~
  [...]

The unsigned NFDBITS macro combined with the signed 1L constant
are causing lots of implicit signed/unsigned type conversions.

Fix this by updating the FD_* macro code to the latest from FreeBSD
and adding an (int) cast to _NFDBITS.

As a side-effect, this fixes the visibility of NFDBITS and
fds_bits (only if __BSD_VISIBLE).

This also eliminates the old, outdated fd_set workaround.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: posix_spawn: add Cygwin-specific code fixing process synchronisation
Corinna Vinschen [Sat, 1 Aug 2020 19:35:58 +0000 (21:35 +0200)]
Cygwin: posix_spawn: add Cygwin-specific code fixing process synchronisation

Newlib's posix_spawn has been taken from FreeBSD.  The code relies on
BSD-specific behaviour of vfork, namely the fact that vfork blocks
the parent until the child exits or calls execve as well as the fact
that the child shares parent memory in non-COW mode.

This behaviour can't be emulated by Cygwin.  Cygwin's vfork is
equivalent to fork.  This is POSIX-compliant, but it's lacking BSD's
vfork ingrained synchronization of the parent to wait for the child
calling execve, or the chance to just write a variable and the parent
will see the result.

So this requires a Cygwin-specific solution.  The core function of
posix_spawn, called do_posix_spawn is now implemented twice, once using
the BSD method, and once for Cygwin using Windows synchronization under
the hood waiting for the child to call execve and signalling errors
upstream.  The Windows specifics are hidden inside Cygwin, so newlib
only calls internal Cygwin functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Speed up dumper
Jon Turney [Mon, 6 Jul 2020 14:10:40 +0000 (15:10 +0100)]
Cygwin: Speed up dumper

Stop after we've written the dump in response to the initial breakpoint
EXCEPTION_DEBUG_EVENT we recieve for attaching to the process.

(rather than bogusly sitting there for 20 seconds waiting for more debug
events from a stopped process after we've already written the dump).

3 years agoCygwin: Remove synchronization event from dumper
Jon Turney [Mon, 6 Jul 2020 14:02:39 +0000 (15:02 +0100)]
Cygwin: Remove synchronization event from dumper

The use of the 'cygwin_error_start_event' for synchronization with
dumper was removed from the DLL in commit 8abeff1e (April 2001).

3 years agoCygwin: Add --nokill dumper option
Jon Turney [Mon, 6 Jul 2020 13:51:32 +0000 (14:51 +0100)]
Cygwin: Add --nokill dumper option

Add --nokill option to dumper, for compatibility with minidumper, and to
assist with testing.

3 years agoarm: Fix include to avoid undefined reference
Sebastian Huber [Wed, 29 Jul 2020 14:24:13 +0000 (16:24 +0200)]
arm: Fix include to avoid undefined reference

ld: libm.a(lib_a-fesetenv.o): in function `fesetenv':
newlib/libm/machine/arm/fesetenv.c:38: undefined reference to `vmsr_fpscr'

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
3 years agoarm: Split fenv.c into multiple files
Eshan dhawan [Thu, 23 Jul 2020 19:06:46 +0000 (00:36 +0530)]
arm: Split fenv.c into multiple files

Use the already existing stub files if possible.  These files are
necessary to override the stub implementation with the machine-specific
implementation through the build system.

Reviewed-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
3 years agoarm: Fix fenv support
Eshan dhawan [Sat, 18 Jul 2020 19:52:53 +0000 (01:22 +0530)]
arm: Fix fenv support

The previous fenv support for ARM used the soft-float implementation of
FreeBSD.  Newlib uses the one from libgcc by default.  They are not
compatible.  Having an GCC incompatible soft-float fenv support in
Newlib makes no sense.  A long-term solution could be to provide a
libgcc compatible soft-float support.  This likely requires changes in
the GCC configuration.  For now, provide a stub implementation for
soft-float multilibs similar to RISC-V.

Move implementation to one file and delete now unused files.  Hide
implementation details.  Remove function parameter names from header
file to avoid name conflicts.

Provide VFP support if __SOFTFP__ is not defined like glibc.

Reviewed-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
3 years agoCygwin: Decorate NtQueryVirtualMemory() to fix 32-bit build
Jon Turney [Tue, 28 Jul 2020 12:25:00 +0000 (13:25 +0100)]
Cygwin: Decorate NtQueryVirtualMemory() to fix 32-bit build

Decorate NtQueryVirtualMemory() with NTAPI (for stdcall) to fix 32-bit
build.

Reported-by: Takashi Yano <takashi.yano@nifty.ne.jp>
3 years agoriscv: fix integer wraparound in memcpy
PkmX via Newlib [Fri, 24 Jul 2020 11:07:45 +0000 (19:07 +0800)]
riscv: fix integer wraparound in memcpy

This patch fixes a bug in RISC-V's memcpy implementation where an
integer wraparound occurs when src + size < 8 * sizeof(long), causing
the word-sized copy loop to be incorrectly entered.

Signed-off-by: Chih-Mao Chen <cmchen@andestech.com>
3 years agofhandler_proc.cc(format_proc_cpuinfo): add flags and TLB size
Brian Inglis [Wed, 22 Jul 2020 19:22:54 +0000 (13:22 -0600)]
fhandler_proc.cc(format_proc_cpuinfo): add flags and TLB size

update to Linux-next 5.8 order fields and flags:
add amd_dcm, arch_lbr, arch_perfmon, art, cpuid, extd_apicid, ibpb,
ibrs, ibrs_enhanced, nonstop_tsc_s3, nopl, rep_good, ring3mwait, ssbd,
stibp, tsc_known_freq, tsc_reliable, xtopology flags;
add TLB size line;
add ftuprint macro for feature test unconditional flag print;
add commented out flags requiring CR or MSR access in print order with
comment explaining issue;
make cpuid leaf numbers consistent 8 hex digits for searching

4 years agoCygwin: mmap: Remove AT_ROUND_TO_PAGE workaround
Corinna Vinschen [Mon, 20 Jul 2020 18:55:43 +0000 (20:55 +0200)]
Cygwin: mmap: Remove AT_ROUND_TO_PAGE workaround

It's working on 32 bit OSes only anyway. It even fails on WOW64.

Drop unsupported NtMapViewOfSection flags.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: mmap: document recent bugfix
Ken Brown [Tue, 21 Jul 2020 21:57:37 +0000 (17:57 -0400)]
Cygwin: mmap: document recent bugfix

4 years agoCygwin: Use MEMORY_WORKING_SET_EX_INFORMATION in dumper
Jon Turney [Tue, 7 Jul 2020 19:54:27 +0000 (20:54 +0100)]
Cygwin: Use MEMORY_WORKING_SET_EX_INFORMATION in dumper

Use the (undocumented) MEMORY_WORKING_SET_EX_INFORMATION in dumper to
determine if a MEM_IMAGE region is unsharable, and hence has been
modified.

After this, we will end up dumping memory regions where:

- state is MEM_COMMIT (i.e. is not MEM_RESERVE or MEM_FREE), and
-- type is MEM_PRIVATE and protection allows reads (i.e. not a guardpage), or
-- type is MEM_IMAGE and attribute is non-sharable (i.e. it was WC, got
   written to, and is now a RW copy)

4 years agoCygwin: Don't dump non-writable image regions
Jon Turney [Sun, 5 Jul 2020 13:42:59 +0000 (14:42 +0100)]
Cygwin: Don't dump non-writable image regions

After this, we will end up dumping memory regions where:

- state is MEM_COMMIT (i.e. is not MEM_RESERVE or MEM_FREE), and
-- type is MEM_PRIVATE and protection allows reads (i.e. not a guardpage), or
-- type is MEM_IMAGE and protection allows writes

Making this decision based on the current protection isn't 100% correct,
because it may have been changed using VirtualProtect().  But we don't
know how to determine if a region is shareable.

(As a practical matter, anything which gets us the stack (MEM_PRIVATE)
and .data/.bss (RW MEM_IMAGE) is going to be enough for 99% of cases)

4 years agoCygwin: Drop excluded regions list from dumper
Jon Turney [Sat, 4 Jul 2020 14:57:31 +0000 (15:57 +0100)]
Cygwin: Drop excluded regions list from dumper

Drop excluded regions, now it's always empty

4 years agoCygwin: Remove reading of PE for section flags from dumper
Jon Turney [Sat, 4 Jul 2020 14:51:14 +0000 (15:51 +0100)]
Cygwin: Remove reading of PE for section flags from dumper

4 years agoCygwin: Show details of all memory regions in dumper debug output
Jon Turney [Wed, 1 Jul 2020 15:08:59 +0000 (16:08 +0100)]
Cygwin: Show details of all memory regions in dumper debug output

4 years agoCygwin: mmap: constify pagesize throughout
Corinna Vinschen [Mon, 20 Jul 2020 15:53:29 +0000 (17:53 +0200)]
Cygwin: mmap: constify pagesize throughout

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: mmap: fix mapping beyond EOF on 64 bit
Ken Brown [Mon, 20 Jul 2020 12:59:09 +0000 (08:59 -0400)]
Cygwin: mmap: fix mapping beyond EOF on 64 bit

Commit 605bdcd410384dda6db66b9b8cd19e863702e1bb enabled mapping beyond
EOF in 64 bit environments.  But the variable 'orig_len' did not get
rounded up to a multiple of 64K.  This rounding was done on 32 bit
only.  Fix this by rounding up orig_len on 64 bit, in the same place
where 'len' is rounded up.

Rounding up is needed to make sigbus_page_len a multiple of the
allocation granularity.

In addition, failing to round up could cause orig_len to be smaller
than len.  Since these are both unsigned values, the statement
'orig_len -= len' could then cause orig_len to be huge, and mmap would
fail with errno EFBIG.

I observed this failure while debugging the problem reported in

  https://sourceware.org/pipermail/cygwin/2020-July/245557.html.

The failure can be seen by running the test case in that report under
gdb or strace.

4 years agoCygwin: pty: Fix a bug on redirecting something to /dev/pty*.
Takashi Yano via Cygwin-patches [Sat, 18 Jul 2020 04:48:47 +0000 (13:48 +0900)]
Cygwin: pty: Fix a bug on redirecting something to /dev/pty*.

- After commit 0365031ce1347600d854a23f30f1355745a1765c, key input
  becomes not working by following steps.
   1) Start cmd.exe in mintty.
   2) Open another mintty.
   3) Execute "echo AAA > /dev/pty*" (pty* is the pty opened in 1.)
  This patch fixes the issue.

4 years agoCygwin: sockets: Rearrange check for connect failure
Corinna Vinschen [Mon, 20 Jul 2020 07:49:07 +0000 (09:49 +0200)]
Cygwin: sockets: Rearrange check for connect failure

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: FIFO: document recent fixes
Ken Brown [Thu, 16 Jul 2020 20:21:03 +0000 (16:21 -0400)]
Cygwin: FIFO: document recent fixes

4 years agoCygwin: FIFO: update commentary
Ken Brown [Sat, 11 Jul 2020 19:43:44 +0000 (15:43 -0400)]
Cygwin: FIFO: update commentary

4 years agoCygwin: FIFO: clean up
Ken Brown [Wed, 15 Jul 2020 20:58:18 +0000 (16:58 -0400)]
Cygwin: FIFO: clean up

Remove the fhandler_fifo::get_me method, which is no longer used.
Make the methods get_owner, set_owner, owner_lock, and owner_unlock
private.

4 years agoCygwin: FIFO: allow take_ownership to be interrupted
Ken Brown [Mon, 13 Jul 2020 11:01:57 +0000 (07:01 -0400)]
Cygwin: FIFO: allow take_ownership to be interrupted

Use cygwait in take_ownership to allow interruption while waiting to
become owner.  Return the cygwait return value or a suitable value to
indicate an error.

raw_read now checks the return value and acts accordingly.

4 years agoCygwin: fhandler_fifo::take_ownership: don't set event unnecessarily
Ken Brown [Sun, 12 Jul 2020 22:11:38 +0000 (18:11 -0400)]
Cygwin: fhandler_fifo::take_ownership: don't set event unnecessarily

Don't set update_needed_evt if there's currently no owner.  This will
cause unnecessary churn once I'm the owner and am listening for
connections.

4 years agoCygwin: FIFO: add missing lock
Ken Brown [Wed, 15 Jul 2020 20:13:47 +0000 (16:13 -0400)]
Cygwin: FIFO: add missing lock

4 years agoCygwin: FIFO: make certain errors non-fatal
Ken Brown [Sat, 11 Jul 2020 19:20:45 +0000 (15:20 -0400)]
Cygwin: FIFO: make certain errors non-fatal

If update_my_handlers fails to duplicate one or more handles, just
mark the corresponding handlers as being in an error state.

But if update_my_handlers is unable to open the process of the
previous owner, it's likely that something serious has gone wrong, so
we continue to make that a fatal error.

4 years agoCygwin: FIFO: fix indentation
Ken Brown [Sat, 11 Jul 2020 18:55:39 +0000 (14:55 -0400)]
Cygwin: FIFO: fix indentation

4 years agoCygwin: FIFO: improve taking ownership in fifo_reader_thread
Ken Brown [Sat, 11 Jul 2020 18:52:55 +0000 (14:52 -0400)]
Cygwin: FIFO: improve taking ownership in fifo_reader_thread

When a reader takes ownership in fifo_reader_thread, it now goes
directly to the part of the main loop that listens for a connection.
Previously it went back to the beginning of the loop.

Also, if the reader has to delay taking ownership because the previous
owner has not finished updating the shared fifo_client handlers, it
now checks to see if cancel_evt has been set.  Previously it might
have had to spin its wheels unnecessarily only to eventually find that
its thread had been canceled.

4 years agoCygwin: FIFO: reduce I/O interleaving
Ken Brown [Sat, 11 Jul 2020 18:34:24 +0000 (14:34 -0400)]
Cygwin: FIFO: reduce I/O interleaving

Add a bool member 'last_read' to the fifo_client_handler structure,
which is set to true on a successful read.  This is used by raw_read
as follows.

When raw_read is called, it first locates the writer (if any) for
which last_read is true.  raw_read tries to read from that writer and
returns if there is input available.  Otherwise, it proceeds to poll
all the writers, as before.

The effect of this is that if a writer writes some data that is only
partially read, the next attempt to read will continue to read from
the same writer.  This should reduce the interleaving of output from
different writers.

4 years agoCygwin: fhandler_fifo::hit_eof: improve reliability
Ken Brown [Sat, 11 Jul 2020 18:23:11 +0000 (14:23 -0400)]
Cygwin: fhandler_fifo::hit_eof: improve reliability

Use the writer count introduced in the previous commit to help detect
EOF.  Drop the maybe_eof method, which is no longer needed.

4 years agoCygwin: FIFO: keep a writer count in shared memory
Ken Brown [Sat, 11 Jul 2020 18:05:23 +0000 (14:05 -0400)]
Cygwin: FIFO: keep a writer count in shared memory

When a reader opens, it needs to block if there are no writers open
(unless is is opened with O_NONBLOCK).  This is easy for the first
reader to test, since it can just wait for a writer to signal that it
is open (via the write_ready event).  But when a second reader wants
to open, all writers might have closed.

To check this, use a new '_nwriters' member of struct fifo_shmem_t,
which keeps track of the number of open writers.  This should be more
reliable than the previous method.

Add nwriters_lock to control access to shmem->_nwriters, and remove
reader_opening_lock, which is no longer needed.

Previously only readers had access to the shared memory, but now
writers access it too so that they can increment _nwriters during
open/dup/fork/exec and decrement it during close.

Add an optional 'only_open' argument to create_shmem for use by
writers, which only open the shared memory rather than first trying to
create it.  Since writers don't need to access the shared memory until
they have successfully connected to a pipe instance, they can safely
assume that a reader has already created the shared memory.

For debugging purposes, change create_shmem to return 1 instead of 0
when a reader successfully opens the shared memory after finding that
it had already been created.

Remove check_write_ready_evt, write_ready_ok_evt, and
check_write_ready(), which are no longer needed.

When opening a writer and looping to try to get a connection, recheck
read_ready at the top of the loop since the number of readers might
have changed.

To slightly speed up the process of opening the first reader, take
ownership immediately rather than waiting for the fifo_reader_thread
to handle it.

4 years agoCygwin: FIFO: fix problems finding new owner
Ken Brown [Wed, 15 Jul 2020 13:46:42 +0000 (09:46 -0400)]
Cygwin: FIFO: fix problems finding new owner

When the owning reader closes and there are still readers open, the
owner needs to wait for a new owner to be found before closing its
fifo_client handlers.  This involves a loop in which dec_nreaders is
called at the beginning and inc_nreaders is called at the end.  Any
other reader that tries to access shmem->_nreaders during this loop
will therefore get an inaccurate answer.

Fix this by adding an nreaders method and using it instead of
dec_nreaders and inc_nreaders.  Also add nreaders_lock to control
access to the shmem->_nreaders.

Make various other changes to improve the reliability of finding a new
owner.

4 years agoctype.h: Fix unused variable warnings
Aschref Ben Thabet [Thu, 16 Jul 2020 08:28:49 +0000 (10:28 +0200)]
ctype.h: Fix unused variable warnings

If __HAVE_LOCALE_INFO__ is not defined, then the locale in the
locale-specific ctype functions is ignored.  In the previous
implementation this resulted in compiler warnings.  For example:

int main()
{
  locale_t locale;
  locale = duplocale(uselocale((locale_t)0));
  isspace_l('x', locale);
  return 0;
}

gcc -Wall main.c
main.c: In function 'main':
main.c:6:11: warning: variable 'locale' set but not used [-Wunused-but-set-variable]
    6 |  locale_t locale;
      |           ^~~~~~

4 years agoCygwin: document previous poll/select patch
Corinna Vinschen [Thu, 16 Jul 2020 08:58:40 +0000 (10:58 +0200)]
Cygwin: document previous poll/select patch

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: make sure failed sockets always signal writability
Marc Hoersken [Wed, 15 Jul 2020 18:53:21 +0000 (20:53 +0200)]
Cygwin: make sure failed sockets always signal writability

Since FD_CONNECT is only given once, we manually need to set
FD_WRITE for connection failed sockets to have consistent
behaviour in programs calling poll/select multiple times.

Example test to non-listening port: curl -v 127.0.0.1:47

4 years agoCygwin: FAQ 1.6: Update "Who's behind the project?"
Brian Inglis [Mon, 13 Jul 2020 13:30:07 +0000 (07:30 -0600)]
Cygwin: FAQ 1.6: Update "Who's behind the project?"

winsup/doc/faq-what.xml: remove Red Hat, Net, Win32 references and clean up

4 years agoCygwin: FAQ 1.5: Clarify "What version is this"
Brian Inglis [Mon, 13 Jul 2020 12:58:56 +0000 (06:58 -0600)]
Cygwin: FAQ 1.5: Clarify "What version is this"

Patch to:
https://sourceware.org/git/?p=newlib-cygwin.git;f=winsup/doc/faq-what.xml;a=blob
as a result of thread:
https://cygwin.com/pipermail/cygwin/2020-July/245442.html
and comments:
https://cygwin.com/pipermail/cygwin-patches/2020q3/010331.html
Relate Cygwin DLL to Unix kernel,
add required options to command examples,
differentiate Unix and Cygwin commands;
mention that the cygwin package contains the DLL,
replace setup.exe reference by Cygwin Setup program wording.

4 years agoCygwin: Make dumper scan more than first 4GB of VM on x86_64
Jon Turney [Wed, 1 Jul 2020 13:00:53 +0000 (14:00 +0100)]
Cygwin: Make dumper scan more than first 4GB of VM on x86_64

It's unclear that we need an end address here at all, or can just rely
on VirtualQueryEx() failing when we reach the end of memory regions.

4 years agoCygwin: Add a new win32_pstatus data type for modules on x86_64
Jon Turney [Mon, 29 Jun 2020 15:45:26 +0000 (16:45 +0100)]
Cygwin: Add a new win32_pstatus data type for modules on x86_64

Also take a bit more care with sizes in other data types to ensure they
are the same on x86 and x86_64.

Add some explanatory comments.

4 years agoCygwin: Update ELF target used by dumper on x86_64
Jon Turney [Mon, 29 Jun 2020 13:36:00 +0000 (14:36 +0100)]
Cygwin: Update ELF target used by dumper on x86_64

Like [1], but actually making the effort to be 'usable' and 'tested'.

[1] https://cygwin.com/pipermail/cygwin/2019-October/242815.html

4 years agoCygwin: Slightly improve error_start documentation
Jon Turney [Wed, 10 Jun 2020 13:52:41 +0000 (14:52 +0100)]
Cygwin: Slightly improve error_start documentation

4 years agotestsuite: Fix iconv tests to use new encoding config defines
Keith Packard via Newlib [Thu, 9 Jul 2020 23:58:48 +0000 (16:58 -0700)]
testsuite: Fix iconv tests to use new encoding config defines

_ICONV_CONVERTER -> ICONV_FROM_ENCODING. It's not perfect, as the
library can support different from/to encodings now, but at least in
the default configurations the tests now work.

Signed-off-by: Keith Packard <keithp@keithp.com>
4 years agolibc/iconv: find_alias was mis-computing remaining alias table length
Keith Packard via Newlib [Thu, 9 Jul 2020 23:58:47 +0000 (16:58 -0700)]
libc/iconv: find_alias was mis-computing remaining alias table length

This caused the strnstr to walk off the end of the alias array and
fetch invalid data. Instead of attempting to update 'len', just
re-compute it based on the table end pointer that is already known.

Signed-off-by: Keith Packard <keithp@keithp.com>
4 years agolibc/iconv: Remove unneeded pointer var for _iconv_aliases
Keith Packard via Newlib [Thu, 9 Jul 2020 23:58:46 +0000 (16:58 -0700)]
libc/iconv: Remove unneeded pointer var for _iconv_aliases

The pointer value for the iconv alias data never changes, so get rid
of the pointer and make it an array instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
4 years agolibc/iconv: Detect CES handler loading failure
Keith Packard via Newlib [Thu, 9 Jul 2020 23:58:45 +0000 (16:58 -0700)]
libc/iconv: Detect CES handler loading failure

Fix the code checking for character set loading failure so that
it checks the return value from the init function.

Signed-off-by: Keith Packard <keithp@keithp.com>
4 years agoFix invalid acl_entry_t on 32-bit Cygwin
David Allsopp [Thu, 9 Jul 2020 19:17:03 +0000 (20:17 +0100)]
Fix invalid acl_entry_t on 32-bit Cygwin

If the acl_t struct was at or above 0x80000000 then the pointer was
sign-extended to 0xffff_ffff_8000_0000 and so the index was lost.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
4 years agoCygwin: convert sys_wcstombs/sys_mbstowcs wrapper to inline functions
Corinna Vinschen [Fri, 10 Jul 2020 08:29:33 +0000 (10:29 +0200)]
Cygwin: convert sys_wcstombs/sys_mbstowcs wrapper to inline functions

This should slightly speed up especially path conversions,
given there's one less function call rearranging all function
arguments in registers/stack (and less stack pressure).

For clarity, rename overloaded  sys_wcstombs to _sys_wcstombs
and sys_cp_mbstowcs to _sys_mbstowcs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: Bump DLL version to 3.1.7
Corinna Vinschen [Thu, 9 Jul 2020 08:14:20 +0000 (10:14 +0200)]
Cygwin: Bump DLL version to 3.1.7

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: add microcode patch to release messages cygwin-3_1_6-release
Corinna Vinschen [Thu, 9 Jul 2020 07:55:34 +0000 (09:55 +0200)]
Cygwin: add microcode patch to release messages

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.075574 seconds and 5 git commands to generate.