]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
3 years agogcc: quiet Wattribute for no_sanitize("address")
rlibby [Sat, 21 Dec 2019 02:43:20 +0000 (02:43 +0000)]
gcc: quiet Wattribute for no_sanitize("address")

This is an unfortunate instance where the __has_attribute check does
not function usefully.  Gcc does have the attribute, but for gcc it only
applies to functions, not variables, and trying to apply it to a
variable generates Wattribute.  So far we only apply the attribute to
variables.  Only enable the attribute for clang, for now.

Reviewed by: Anton Rang <rang at acm.org>
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22875

3 years agoDon't sanitize linker_set
dab [Tue, 19 Nov 2019 14:46:28 +0000 (14:46 +0000)]
Don't sanitize linker_set

The assumptions of linker_set don't play nicely with
AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around
globals (including those in named sections), whereas linker_set
assumes they are all packed consecutively like a pointer array. So:
let's annotate linker_set so that AddressSanitizer ignores it.

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: kib, rang_acm.org
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22239

3 years agoMake the system C11 atomics headers fully compatible with external GCC.
jhb [Mon, 6 Aug 2018 23:51:08 +0000 (23:51 +0000)]
Make the system C11 atomics headers fully compatible with external GCC.

The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure.  This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile.  Fix this by not hiding atomic variables
in a structure for modern versions of GCC.  The headers already avoid
using a wrapper structure on clang.

Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.

Reported by: Mark Millard
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16585

3 years agoCygwin: pty: Fix race condition in initialization of pseudo console.
Takashi Yano via Cygwin-patches [Mon, 26 Oct 2020 08:29:31 +0000 (17:29 +0900)]
Cygwin: pty: Fix race condition in initialization of pseudo console.

- If output of non-cygwin process is piped to cygwin process, such
  as less, the non-cygwin process sometimes fails to start and hangs.
  This patch fixes the issue.

3 years agoCygwin: AF_INET and AF_LOCAL: recv_internal: fix MSG_WAITALL support
Ken Brown via Cygwin-patches [Mon, 12 Oct 2020 18:02:13 +0000 (14:02 -0400)]
Cygwin: AF_INET and AF_LOCAL: recv_internal: fix MSG_WAITALL support

If MSG_WAITALL is set, recv_internal calls WSARecv or WSARecvFrom in a
loop, in an effort to fill all the scatter-gather buffers.  The test
for whether all the buffers are full was previously incorrect.

3 years agoCygwin: Drop do-nothing install_target target
Jon Turney [Mon, 19 Oct 2020 13:34:35 +0000 (14:34 +0100)]
Cygwin: Drop do-nothing install_target target

3 years agoCygwin: Drop do-nothing install_host target
Jon Turney [Fri, 16 Oct 2020 14:06:43 +0000 (15:06 +0100)]
Cygwin: Drop do-nothing install_host target

Drop do-nothing install_host target, which is only used when not
cross-compiling.

3 years agoCygwin: Remove nostdlib Makefile variable
Jon Turney [Sat, 3 Oct 2020 20:39:40 +0000 (21:39 +0100)]
Cygwin: Remove nostdlib Makefile variable

It's used in one place, and it's value is unconditional.

3 years agoCygwin: gendef generates sigfe.s and cygwin.def
Jon Turney [Mon, 12 Oct 2020 15:59:02 +0000 (16:59 +0100)]
Cygwin: gendef generates sigfe.s and cygwin.def

Express that gendef generates sigfe.s and cygwin.def in a slightly less
nutty way.

3 years agoCygwin: Drop cygwin version.o from cygserver
Jon Turney [Mon, 12 Oct 2020 15:50:18 +0000 (16:50 +0100)]
Cygwin: Drop cygwin version.o from cygserver

The data it contains isn't referenced since 9e9bc3a4.

3 years agoCygwin: Remove lsaauth
Jon Turney [Mon, 12 Oct 2020 13:47:22 +0000 (14:47 +0100)]
Cygwin: Remove lsaauth

Remove lsaauth, not built since 2741dd05.

3 years agoCygwin: Use aclocal option --system-acdir rather than --acdir
Jon Turney [Thu, 15 Oct 2020 17:47:36 +0000 (18:47 +0100)]
Cygwin: Use aclocal option --system-acdir rather than --acdir

In autogen.sh, use 'aclocal --system-acdir' rather than 'aclocal --acdir'.

'--acdir' was deprecated in automake 1.11 and removed in automake 1.13.

3 years agoCygwin: Remove --with-windows-{libs,headers}
Jon Turney [Wed, 14 Oct 2020 15:49:45 +0000 (16:49 +0100)]
Cygwin: Remove --with-windows-{libs,headers}

3 years agoCygwin: Remove ccwrap
Jon Turney [Sat, 3 Oct 2020 13:41:58 +0000 (14:41 +0100)]
Cygwin: Remove ccwrap

ccwrap massages the compiler's standard include directories to remove
'/usr/include/w32api', with the intent of allowing it to be overriden by
'--with-windows-headers' (See 4c36016b).

I'm not 100% convinced that this is always working as desired, since in
some places w32api includes are done using <w32api/something.h>, which
will find them via the path /usr/include.

If this does turn out to be needed, this could also be implemented by
constructing the appropriate compiler flags once, rather than on every
compiler invocation.

3 years agoCygwin: Stop using c++wrap for MinGW-compiled utilities
Jon Turney [Thu, 16 Mar 2017 15:02:20 +0000 (15:02 +0000)]
Cygwin: Stop using c++wrap for MinGW-compiled utilities

Stop using c++wrap for MinGW-compiled utilities.

(Partially reverts 96079146)

3 years agolibc/time: Move internal newlib tz-structs into own header
Torbjörn SVENSSON via Newlib [Mon, 5 Oct 2020 12:50:13 +0000 (14:50 +0200)]
libc/time: Move internal newlib tz-structs into own header

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch moves the internal struct __tzrule_struct to its own
internal header sys/_tz_structs.h.  This is included from newlib's
time code as well as from Cygwin's localtime wrapper.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Remove unused doc/ug-info.xml
Jon Turney [Thu, 8 Oct 2020 16:33:24 +0000 (17:33 +0100)]
Cygwin: Remove unused doc/ug-info.xml

Remove doc/ug-info.xml, not used in any document.

3 years agoCygwin: Remove empty MT_SAFE and MT_SAFE_OBJECTS
Jon Turney [Thu, 8 Oct 2020 14:41:24 +0000 (15:41 +0100)]
Cygwin: Remove empty MT_SAFE and MT_SAFE_OBJECTS

3 years agoCygwin: Remove autoconf variable INSTALL_LICENSE
Jon Turney [Wed, 7 Oct 2020 12:59:45 +0000 (13:59 +0100)]
Cygwin: Remove autoconf variable INSTALL_LICENSE

Remove autoconf variable INSTALL_LICENSE, which has a constant value
which is only used once.

3 years agoCygwin: Drop AC_SUBST(LIBSERVER)
Jon Turney [Mon, 12 Oct 2020 13:27:55 +0000 (14:27 +0100)]
Cygwin: Drop AC_SUBST(LIBSERVER)

The autoconf variable LIBSERVER isn't defined, and it's value isn't
used. (The Makefile.in contains a literal value for the name of this
library instead).

3 years agoCygwin: Remove AC_ARG_PROGRAM/program_transform_name
Jon Turney [Mon, 12 Oct 2020 13:18:17 +0000 (14:18 +0100)]
Cygwin: Remove AC_ARG_PROGRAM/program_transform_name

Not done consistently, and probably never used.

3 years agoCygwin: Remove AC_PROG_MAKE_SET
Jon Turney [Mon, 12 Oct 2020 13:12:40 +0000 (14:12 +0100)]
Cygwin: Remove AC_PROG_MAKE_SET

This is only needed if we are using an ancient make which doesn't set
${MAKE}, but we say "This makefile requires GNU make." everywhere.

It only has an effect if @SET_MAKE@ is used, which we aren't doing
consistently.

3 years agoCygwin: Drop STDINCFLAGS overrides
Jon Turney [Sat, 3 Oct 2020 15:39:38 +0000 (16:39 +0100)]
Cygwin: Drop STDINCFLAGS overrides

This used to turn off -nostdinc on a per-file basis, but has no effect
since 4c36016b5706.

3 years agoCygwin: Drop looking for w32api in winsup/w32api
Jon Turney [Fri, 25 Sep 2020 19:59:14 +0000 (20:59 +0100)]
Cygwin: Drop looking for w32api in winsup/w32api

Stop looking for w32api headers in the (no longer existent)
winsup/w32api directory (removed in commit 61746d6ae850).

3 years agoformat_proc_cpuinfo: add enqcmd cpuinfo flag
Brian Inglis [Tue, 13 Oct 2020 15:11:08 +0000 (09:11 -0600)]
format_proc_cpuinfo: add enqcmd cpuinfo flag

Add linux-next 5.9 cpuinfo flag for Intel enqcmd/s instructions:
x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions:
Work submission instruction comes in two flavors. ENQCMD can be called
both in ring 3 and ring 0 and always uses the contents of a PASID MSR
when shipping the command to the device. ENQCMDS allows a kernel driver
to submit commands on behalf of a user process. The driver supplies the
PASID value in ENQCMDS. There isn't any usage of ENQCMD in the kernel as
of now.
The CPU feature flag is shown as "enqcmd" in /proc/cpuinfo.

3 years agodrop ambiguous-wide behaviour from Unicode CJK locales
Thomas Wolff [Wed, 7 Oct 2020 16:35:54 +0000 (18:35 +0200)]
drop ambiguous-wide behaviour from Unicode CJK locales

3 years agoCygwin: AF_UNIX: open_pipe: call recv_peer_info
Ken Brown [Sun, 4 Oct 2020 15:05:33 +0000 (11:05 -0400)]
Cygwin: AF_UNIX: open_pipe: call recv_peer_info

If open_pipe is called with xchg_sock_info true, call recv_peer_info
in addition to send_sock_info.

3 years agoCygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS
Ken Brown [Sat, 3 Oct 2020 16:37:36 +0000 (12:37 -0400)]
Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS

A successful connection can be indicated by STATUS_SUCCESS or
STATUS_PIPE_CONNECTED.  Previously we were checking only for the
latter.

3 years agoCygwin: AF_UNIX: socket: set the O_RDWR flag
Ken Brown [Sun, 4 Oct 2020 14:18:54 +0000 (10:18 -0400)]
Cygwin: AF_UNIX: socket: set the O_RDWR flag

3 years agoCygwin: always recognize AF_UNIX sockets as reparse points
Ken Brown [Tue, 29 Sep 2020 20:18:15 +0000 (16:18 -0400)]
Cygwin: always recognize AF_UNIX sockets as reparse points

If __WITH_AF_UNIX is defined when Cygwin is built, then a named
AF_UNIX socket is represented by a reparse point with a
Cygwin-specific tag and GUID.  Make such files recognizable as reparse
points (but not as sockets) even if __WITH_AF_UNIX is not defined.
That way utilities such as 'ls' and 'rm' still behave reasonably.

This requires two changes:

- Define the GUID __cygwin_socket_guid unconditionally.

- Make check_reparse_point_target return PATH_REP on a reparse point
  of this type if __WITH_AF_UNIX is not defined.

3 years agoCygwin: fix handling of known reparse points that are not symlinks
Ken Brown [Mon, 28 Sep 2020 20:34:44 +0000 (16:34 -0400)]
Cygwin: fix handling of known reparse points that are not symlinks

Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed check_reparse_point_target so that it could return
a positive value on a known reparse point that is not a symlink.  But
some of the code in check_reparse_point that handles this positive
return value was executed unconditionally, when it should have been
executed only for symlinks.

As a result, posixify could be called on a buffer containing garbage,
and check_reparse_point could erroneously return a positive value on a
non-symlink.  This is now fixed so that posixify is only called if the
reparse point is a symlink, and check_reparse_point returns 0 if the
reparse point is not a symlink.

Also fix symlink_info::check to handle this last case, in which
check_reparse_point returns 0 on a known reparse point.

3 years agoCygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed
Ken Brown [Mon, 28 Sep 2020 19:57:56 +0000 (15:57 -0400)]
Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed

The following Windows system calls currently fail with
STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket:

- NtOpenFile in get_file_sd

- NtOpenFile in set_file_sd

- NtCreateFile in fhandler_base::open

Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls
when the file is a known reparse point.

3 years agolibc/include/wchar.h: Remove parameter name
Torbjörn SVENSSON [Thu, 1 Oct 2020 10:46:51 +0000 (12:46 +0200)]
libc/include/wchar.h: Remove parameter name

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch removes the 'ptr' parameter name from
wint_t _getwchar_r (struct _reent *);
wint_t _getwchar_unlocked_r (struct _reent *);

to avoid possible clashes with user code in case someone uses
before including Newlib's wchar.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
3 years agolibc/include/inttypes.h: Remove parameter name
Torbjörn SVENSSON [Thu, 1 Oct 2020 10:44:43 +0000 (12:44 +0200)]
libc/include/inttypes.h: Remove parameter name

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch removes the 'j' parameter name from
extern intmax_t  imaxabs(intmax_t);

to avoid possible clashes with user code in case someone uses
before including Newlib's inttypes.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
3 years agolibgloss: aarch64: Add support for Armv8-R AArch64
Alex Coplan via Newlib [Tue, 29 Sep 2020 16:27:18 +0000 (17:27 +0100)]
libgloss: aarch64: Add support for Armv8-R AArch64

This patch adds support for Armv8-R AArch64.

Armv8-R AArch64 has no EL3, so we don't set vbar_el3, and adjust the
code to set up the MPU for Armv8-R.  So build a different flavour of the
startup code to support that.

We also add a specs file that uses this alternative startup code which
can be used with Armv8-R AArch64 models.

3 years agoCygwin: avoid GCC 10 error with -Werror=narrowing
Jon Turney [Sat, 19 Sep 2020 15:15:40 +0000 (16:15 +0100)]
Cygwin: avoid GCC 10 error with -Werror=narrowing

../../../../src/winsup/cygwin/pinfo.cc: In member function 'DWORD pinfo::status_exit(DWORD)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/pinfo.cc:136:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'

../../../../src/winsup/cygwin/sigproc.cc: In member function 'DWORD child_info::proc_retry(HANDLE)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/sigproc.cc:1120:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'

NT error statuses seem to be variously DWORD (unsigned) or NTSTATUS
(signed)?  So use the one which doesn't cause problems here.

3 years agoCygwin: avoid GCC 10 error with -Werror=narrowing
Jon Turney [Sat, 19 Sep 2020 14:55:09 +0000 (15:55 +0100)]
Cygwin: avoid GCC 10 error with -Werror=narrowing

../../../../src/winsup/cygwin/fhandler_console.cc: In member function 'const unsigned char* fhandler_console::write_normal(const unsigned char*, const unsigned char*)':
../../../../src/winsup/cygwin/fhandler_console.cc:2782:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2786:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2836:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2840:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]

A mbtowc_p function returns an int, so that seems the correct type to use here.

3 years agoCygwin: avoid GCC 10 error with -Werror=parentheses
Jon Turney [Sat, 19 Sep 2020 14:51:10 +0000 (15:51 +0100)]
Cygwin: avoid GCC 10 error with -Werror=parentheses

../../../../src/winsup/cygwin/fhandler_socket_inet.cc: In member function 'ssize_t fhandler_socket_wsock::send_internal(_WSAMSG*, int)':
../../../../src/winsup/cygwin/fhandler_socket_inet.cc:1381:69: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]

3 years agoCygwin: check_reparse_point_target: update comment
Ken Brown [Sat, 26 Sep 2020 20:44:44 +0000 (16:44 -0400)]
Cygwin: check_reparse_point_target: update comment

Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed the return values of check_reparse_point_target.
Update the comment accordingly.

3 years agolibc/include/math.h: Remove parameter name
Christophe Lyon [Mon, 21 Sep 2020 15:22:30 +0000 (15:22 +0000)]
libc/include/math.h: Remove parameter name

As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch removes the 'x' parameter name from
extern int __isinff (float);
extern int __isinfd (double);
extern int __isnanf (float);
extern int __isnand (double);
extern int __fpclassifyf (float);
extern int __fpclassifyd (double);
extern int __signbitf (float);
extern int __signbitd (double);

to avoid possible clashes with user code in case someone uses
before including Newlib's math.h (or uses some other conflicting
definition)

3 years agoAdd C-SKY port for libgloss
Jojo R [Fri, 25 Sep 2020 15:01:25 +0000 (11:01 -0400)]
Add C-SKY port for libgloss

This patch contain all libgloss for C-SKY

Contributor list:
  - Lifang Xia <lifang_xia@c-sky.com>
  - Jojo R <jiejie_rong@c-sky.com>
  - Xianmiao Qu <xianmiao_qu@c-sky.com>
  - Yunhai Shang <yunhai_shang@c-sky.com>

3 years agoCygwin: winlean.h: remove most of the extended memory API
Ken Brown [Wed, 23 Sep 2020 15:04:08 +0000 (11:04 -0400)]
Cygwin: winlean.h: remove most of the extended memory API

This was added as a temporary measure in commit e18f7f99 because it
wasn't yet in the mingw-w64 headers.  With one exception, it is now in
the current release of the headers (version 8.0.0), so we don't need
it in winlean.h.

The exception is that VirtualAlloc2 is declared conditionally in
<w32api/memoryapi.h>, but the compilation of Cygwin requires it to
always be declared, even though it will only be executed on systems
that support it.  So retain the declaration in winlean.h.  And add
"WINAPI" to the declaration, as in memoryapi.h.

Add a check that version >= 8 of the mingw-w64 headers is intalled.

Also revert commit 3d136011, which was a related temporary workaround.

3 years agoPort of C-SKY for newlib
Jojo R [Wed, 23 Sep 2020 19:06:09 +0000 (15:06 -0400)]
Port of C-SKY for newlib

Contributor list:  

  - Lifang Xia <lifang_xia@c-sky.com>  
  - Jojo R <jiejie_rong@c-sky.com>
  - Xianmiao Qu <xianmiao_qu@c-sky.com>
  - Yunhai Shang <yunhai_shang@c-sky.com>

3 years agolibm: Make tgamma(-small) = -INFINITY
Keith Packard [Tue, 15 Sep 2020 17:10:07 +0000 (10:10 -0700)]
libm: Make tgamma(-small) = -INFINITY

Need to copy the argument sign to the output for tgamma(finite)
overflow case.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agowinsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported
Brian Inglis [Fri, 18 Sep 2020 02:53:35 +0000 (20:53 -0600)]
winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

enumerate Vista, 7, 8, 10 progression to be clear, and earliest server 2008;
add 8.1, exclude S mode, add Cygwin32 on ARM, specify 64 bit only AMD/Intel

3 years agofhandler_proc.cc(format_proc_cpuinfo): add tsxldtrk, sev_es flags
Brian Inglis [Thu, 17 Sep 2020 18:51:25 +0000 (12:51 -0600)]
fhandler_proc.cc(format_proc_cpuinfo): add tsxldtrk, sev_es flags

Add linux-next cpuinfo flags for Intel TSX suspend load address tracking
instructions and AMD Secure Encrypted Virtualization with Encrypted State.

3 years agoCygwin: pty: Drop handling for UTF-7 in convert_mb_str().
Takashi Yano [Fri, 11 Sep 2020 15:37:26 +0000 (00:37 +0900)]
Cygwin: pty: Drop handling for UTF-7 in convert_mb_str().

- Charset conversion for UTF-7, ISO-2022 and ISCII, which are not
  supported in cygwin, does not work properly as a result. At the
  expense of the above, the code has been simplified a bit.

3 years agoCygwin: ldd: Also look for not found DLLs when exit status is non-zero
Jon Turney [Mon, 7 Sep 2020 15:24:39 +0000 (16:24 +0100)]
Cygwin: ldd: Also look for not found DLLs when exit status is non-zero

If the process exited with e.g. STATUS_DLL_NOT_FOUND, also process the
file to look for not found DLLs.

(We currently only do this when a STATUS_DLL_NOT_FOUND exception occurs,
which I haven't managed to observe)

This still isn't 100% correct, as it only examines the specified file
for missing DLLs, not recursively on the DLLs it depends upon.

3 years agoCygwin: pty: Prevent garbled output for existing non-cygwin apps.
Takashi Yano via Cygwin-patches [Fri, 11 Sep 2020 10:54:40 +0000 (19:54 +0900)]
Cygwin: pty: Prevent garbled output for existing non-cygwin apps.

- If pseudo console is disabled, non-cygwin apps do not detect
  console device. In this case, some apps output UTF-8 regardless
  of the locale setting. At least git-for-windows, rust-based apps
  and node.js do that. This patch provides backward compatibility
  as default behaviour by setting console codepage to the charset of
  the locale. Even in the cases above, garbled output is prevented
  with this patch in most cases because mintty uses UTF-8 by default.

  I beleave this is not really a problem in cygwin side but that in
  app side, however, some users complain about garbled output with
  existing apps in MSYS2 (which is based on cygwin) in which pseudo
  console is disabled by default.

3 years agoCygwin: pty: setup new pty on opening the master, not in constructor
Corinna Vinschen [Wed, 9 Sep 2020 20:50:11 +0000 (22:50 +0200)]
Cygwin: pty: setup new pty on opening the master, not in constructor

Setting up the pty in the master constructor ends up creating a new pty
on every stat(2) call on /dev/ptmx.  Only do this when actually opening
the device, not when using the device class in another, non-opening
context.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.
Takashi Yano via Cygwin-patches [Wed, 9 Sep 2020 15:28:00 +0000 (00:28 +0900)]
Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.

- If the non-cygwin apps is executed under pseudo console disabled,
  multibyte input for the apps are garbled. This patch fixes the
  issue.

3 years agoCygwin: pty: Revise convert_mb_str() function.
Takashi Yano via Cygwin-patches [Wed, 9 Sep 2020 15:27:59 +0000 (00:27 +0900)]
Cygwin: pty: Revise convert_mb_str() function.

- Use tmp_pathbuf instead of HeapAlloc()/HeapFree().
- Remove mb_str_free() function.
- Consider the case where the multibyte string stops in the middle
  of a multibyte char.

3 years agoCygwin: document last bug fix
Ken Brown [Tue, 8 Sep 2020 18:28:19 +0000 (14:28 -0400)]
Cygwin: document last bug fix

3 years agoCygwin: path_conv::check: handle error from fhandler_process::exists
Ken Brown [Tue, 8 Sep 2020 16:23:32 +0000 (12:23 -0400)]
Cygwin: path_conv::check: handle error from fhandler_process::exists

fhandler_process::exists is called when we are checking a path
starting with "/proc/<pid>/fd".  If it returns virt_none and sets an
errno, there is no need for further checking.  Just set 'error' and
return.

3 years agoCygwin: format_process_fd: add directory check
Ken Brown [Tue, 8 Sep 2020 15:45:09 +0000 (11:45 -0400)]
Cygwin: format_process_fd: add directory check

The incoming path is allowed to have the form "$PID/fd/[0-9]*/.*"
provided the descriptor symlink points to a directory.  Check that
this is indeed the case.

3 years agoCygwin: pty: move codepage evaluation to nlsfuncs.cc
Corinna Vinschen [Tue, 8 Sep 2020 08:36:04 +0000 (10:36 +0200)]
Cygwin: pty: move codepage evaluation to nlsfuncs.cc

The new function __eval_codepage_from_internal_charset
is a simplified version of the former code in
fhandler_tty.cc.  It probably needs some extension,
but the gist is to use knowledge of internals to
be as quick as possible.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: drop internal O_NOSYMLINK and O_DIROPEN flags
Corinna Vinschen [Mon, 7 Sep 2020 20:45:38 +0000 (22:45 +0200)]
Cygwin: drop internal O_NOSYMLINK and O_DIROPEN flags

Both flags are outdated and collide with official flags in
sys/_default_fcntl.h, which may result in weird misbehaviour
of file functions.

O_NOSYMLINK is not used anyway.

O_DIROPEN is used in fhandler_virtual and derived classes.
The collision with O_NOFOLLOW results in spurious EISDIR
errors when, e. g., reading files in the registry.
fhandler_base::open_fs uses O_DIROPEN in the call to
fhandler_base::open, but it's not used in this context
further down the road.

Drop both flags and create an alternative "diropen" bool
flag in fhandler_virtual.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agolibm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2]
Keith Packard via Newlib [Fri, 4 Sep 2020 16:25:27 +0000 (09:25 -0700)]
libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2]

The current gamma, gamma_r, gammaf and gammaf_r functions return
|gamma(x)| instead of ln(|gamma(x)|) due to a change made back in 2002
to the __ieee754_gamma_r implementation. This patch fixes that, making
all of these functions map too their lgamma equivalents.

To fix the underlying bug, the __ieee754_gamma functions have been
changed to return gamma(x), removing the _r variants as those are no
longer necessary. Their names have been changed to __ieee754_tgamma to
avoid potential confusion from users.

Now that the __ieee754_tgamma functions return the correctly signed
value, the tgamma functions have been modified to use them.

libm.a now exposes the following gamma functions:

    ln(|gamma(x)|):

__ieee754_lgamma_r
__ieee754_lgammaf_r

lgamma
lgamma_r
gamma
gamma_r

lgammaf
lgammaf_r
gammaf
gammaf_r

lgammal (on machines where long double is double)

    gamma(x):

__ieee754_tgamma
__ieee754_tgammaf
tgamma
tgammaf
tgammal (on machines where long double is double)

Additional aliases for any of the above functions can be added if
necessary; in particular, I'm not sure if we need to include
__ieee754_gamma*_r functions (which would return ln(|(gamma(x)|).

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

v2:
Switch commit message to ASCII

3 years agolibm/riscv: Use common fma code when necessary
Keith Packard via Newlib [Thu, 3 Sep 2020 20:54:33 +0000 (13:54 -0700)]
libm/riscv: Use common fma code when necessary

For RISC-V targets without hardware FMA support, include the
common fma implementation to provide that API.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agolibm/riscv: Fix machine-specific sqrt build process
Keith Packard via Newlib [Thu, 3 Sep 2020 20:54:32 +0000 (13:54 -0700)]
libm/riscv: Fix machine-specific sqrt build process

Like ARM, some RISC-V implementations have hardware sqrt. Support for
that can be detected at compile time, which the code did. However, the
filenames were incorrect so that both the risc-v specific and general
code were getting included in the resulting library.

Fix this by following the ARM model and #include'ing the general code
when the architecture-specific support is not available.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoMSP430: Fix calculation of string length in sbrk.c
Jozef Lawrynowicz [Thu, 3 Sep 2020 13:00:32 +0000 (14:00 +0100)]
MSP430: Fix calculation of string length in sbrk.c

3 years agoCygwin: create install dir for libs
David McFarland via Cygwin-patches [Thu, 27 Aug 2020 12:02:46 +0000 (09:02 -0300)]
Cygwin: create install dir for libs

This fixes a race in parallel installs.

3 years agoloadlocale: don't casecmp digits
Corinna Vinschen [Fri, 4 Sep 2020 12:21:10 +0000 (14:21 +0200)]
loadlocale: don't casecmp digits

strcmp is sufficient here

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoMSP430: Fix message in sbrk.c printing binary character
Jozef Lawrynowicz [Wed, 2 Sep 2020 15:16:55 +0000 (16:16 +0100)]
MSP430: Fix message in sbrk.c printing binary character

The call to write() in sbrk.c was using the wrong value for the length
argument, causing the NUL terminating character of the string to be
printed.

3 years agoFix warnings when building for msp430-elf
Jozef Lawrynowicz [Wed, 2 Sep 2020 14:50:07 +0000 (15:50 +0100)]
Fix warnings when building for msp430-elf

The MSP430 target supports both 16-bit and 20-bit size_t and intptr_t.
Some implicit casts in Newlib expect these types to be
"long", (a 32-bit type on MSP430) which causes warnings during
compilation such as:
  "cast from pointer to integer of different size"

3 years agolibm/machine/arm: Rename s*_fma.c -> s*_fma_arm.c
Keith Packard via Newlib [Tue, 1 Sep 2020 19:49:49 +0000 (12:49 -0700)]
libm/machine/arm: Rename s*_fma.c -> s*_fma_arm.c

This is required to avoid colliding with files built from libm/common
that would end up with the same object name.

When libm.a was constructed from the individual sub-libraries, the
contents of the libm/common files would be replaced by that from
libm/machine/arm with the same name.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoCygwin: libpthread: Export C11 thread symbols from libpthread.a as well
Corinna Vinschen [Tue, 1 Sep 2020 10:52:08 +0000 (12:52 +0200)]
Cygwin: libpthread: Export C11 thread symbols from libpthread.a as well

...as on glibc right now.  This is supposed to support autoconf scripts
checking for existence of these symbols in libpthread.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: mtx_init: drop glibc workaround
Corinna Vinschen [Tue, 1 Sep 2020 10:46:12 +0000 (12:46 +0200)]
Cygwin: mtx_init: drop glibc workaround

GLibc will change this code in the forseeable future to align more
with FreeBSD, so this hack is not actually desired.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: pty: Fix a bug in the code removing set window title sequence.
Takashi Yano via Cygwin-patches [Mon, 31 Aug 2020 12:02:13 +0000 (21:02 +0900)]
Cygwin: pty: Fix a bug in the code removing set window title sequence.

- Commit 4e08fe42c9f3fdba63a57a8e3a6d705c4e10f50f has a bug which
  may cause infinite loop in pty_master_fwd_thread(). This patch
  fixes the issue.

3 years agoCygwin: pty: Disable pseudo console if TERM does not have CSI6n.
Takashi Yano via Cygwin-patches [Mon, 31 Aug 2020 09:48:54 +0000 (18:48 +0900)]
Cygwin: pty: Disable pseudo console if TERM does not have CSI6n.

- Pseudo console internally sends escape sequence CSI6n (query cursor
  position) on startup of non-cygwin apps. If the terminal does not
  support CSI6n, CreateProcess() hangs waiting for response. To prevent
  hang, this patch disables pseudo console if the terminal does not
  have CSI6n. This is checked on the first execution of non-cygwin
  app using the following steps.
    1) Check if the terminal support ANSI escape sequences by looking
       into terminfo database. If terminfo has cursor_home (ESC [H),
       the terminal is supposed to support ANSI escape sequences.
    2) If the terminal supports ANSI escape sequneces, send CSI6n for
       a test and wait for a responce for 40ms.
    3) If there is a responce within 40ms, CSI6n is supposed to be
       supported.
  Also set-title capability is checked, and removes escape sequence
  for setting window title if the terminal does not have the set-
  title capability.

3 years agoCygwin: Remove waitloop argument from try_to_debug()
Jon Turney [Thu, 27 Aug 2020 15:12:47 +0000 (16:12 +0100)]
Cygwin: Remove waitloop argument from try_to_debug()

Currently, when using CYGWIN's error_start facility, the faulting
process isn't stopped while the error_start process is started when the
fault is caused by an exception. (it even seems possible in theory that
the faulting process could have exited before the error_start process
attaches).

This leads to e.g. the core dump written by CYGWIN='error_start=dumper'
in response to an exception being non-deterministic.

Remove the waitloop argument from try_to_debug(), only used in the
exception case, so the faulting process busy-waits until the error_start
process attaches.

Code archaeology to determine why the code is this way didn't really
turn up any answers, but this seems a low-risk change, as this only
changes the behaviour when:

 - a debugger isn't already attached
 - an error_start is specified in CYGWIN env var
 - an exception has occurred which will be translated to a signal

If error_start invokes something which doesn't attach using
DebugActiveProcess(), we will spin indefinitely, but that will also
currently occur for any of the existing other uses of try_to_debug(),
which default to waitloop=TRUE.

3 years agoCygwin: sigproc.cc: add comment
Ken Brown [Sat, 29 Aug 2020 09:59:56 +0000 (05:59 -0400)]
Cygwin: sigproc.cc: add comment

3 years agoCygwin: Add modfl fix to release notes
Corinna Vinschen [Sun, 30 Aug 2020 12:15:58 +0000 (14:15 +0200)]
Cygwin: Add modfl fix to release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: crt: Add "volatile" to all inline assembly snippets under math
Martin Storsjö [Sun, 30 Aug 2020 12:12:48 +0000 (14:12 +0200)]
Cygwin: crt: Add "volatile" to all inline assembly snippets under math

On 32 bit x86, clang seems to miss loading input parameters based
on asm constraints for inline assembly that uses the x87 floating
registers, unless the snippet has got the volatile keyword.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoCygwin: math/modfl.c: Fix segment faults in modfl().
Liu Hao [Sun, 30 Aug 2020 11:56:31 +0000 (13:56 +0200)]
Cygwin: math/modfl.c: Fix segment faults in modfl().

Reference: https://sourceforge.net/p/mingw-w64/bugs/478/
Signed-off-by: Liu Hao <lh_mouse@126.com>
3 years agoCygwin: Add Cygwin 3.2 release info
Corinna Vinschen [Sun, 30 Aug 2020 11:30:13 +0000 (13:30 +0200)]
Cygwin: Add Cygwin 3.2 release info

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Add C11 threads API
Corinna Vinschen [Sat, 29 Aug 2020 19:29:24 +0000 (21:29 +0200)]
Cygwin: Add C11 threads API

Code taken from FreeBSD, which implements C11 threads as
wrapper around pthreads.  Fix up machine/_threads.h which
is called from newlib's machine-independent threads.h to
match Cygwin's pthreads types.

Add the FreeBSD source files to libc subdir and take
opportunity to define LIBC_OFILES var in Makefile.

Add new symbols to common.din and sort symbols.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: make pthread_yield available for internal usage
Corinna Vinschen [Sat, 29 Aug 2020 19:21:21 +0000 (21:21 +0200)]
Cygwin: make pthread_yield available for internal usage

In preparation of importing FreeBSDs stdthreads functions,
change the way pthread_yield is exported, so that the symbol
can be used internally as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: pthread_yield: Add BSD visibility
Corinna Vinschen [Sat, 29 Aug 2020 19:09:33 +0000 (21:09 +0200)]
Cygwin: pthread_yield: Add BSD visibility

pthread_yield was only declared under GNU visibility,
but the function should be available under BSD visibility
as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: pthreads: iterate over key destructors per POSIX
Corinna Vinschen [Sat, 29 Aug 2020 19:08:31 +0000 (21:08 +0200)]
Cygwin: pthreads: iterate over key destructors per POSIX

POSIX requires that key destructors are called in a loop
for each key with a non-NULL value until all values are
NULL, or until all destructors for non-NULL values
have been called at least PTHREAD_DESTRUCTOR_ITERATIONS
(per POSIX: 4) times.

Cygwinonly called all destructors with non-NULL values
exactly once.  This patch fixes Cygwin to follow POSIX.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Remove .drone.yml
Jon Turney [Sun, 23 Aug 2020 19:31:43 +0000 (20:31 +0100)]
Cygwin: Remove .drone.yml

tea-ci.org was a CI service for MSYS2, but is no longer operating.

3 years agoCygwin: Add github action to cross-build on Fedora
Jon Turney [Sun, 23 Aug 2020 16:49:42 +0000 (17:49 +0100)]
Cygwin: Add github action to cross-build on Fedora

This helps avoid unpleasant surprises when we come to actually make a
release (which are cross-built in this manner)

3 years agoCygwin: Add .appveyor.yml
Jon Turney [Sun, 23 Aug 2020 19:33:22 +0000 (20:33 +0100)]
Cygwin: Add .appveyor.yml

This is a slightly more polished version of the configuration being used
for CI builds at https://ci.appveyor.com/project/cygwin/cygwin, which is
not currently under version control.

3 years agoCygwin: sigproc: Fix a thinko in array size
Corinna Vinschen [Fri, 28 Aug 2020 17:38:05 +0000 (19:38 +0200)]
Cygwin: sigproc: Fix a thinko in array size

We need one more entry than max children in the arrays.
There's no reason to do this for the static array, though.
One more entry in the overflow array is sufficient.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: sigproc: Eliminate redundant copying of chld_procs
Corinna Vinschen [Fri, 28 Aug 2020 17:34:52 +0000 (19:34 +0200)]
Cygwin: sigproc: Eliminate redundant copying of chld_procs

On PROC_EXEC_CLEANUP, the pinfo's in chld_procs are removed.
This is done in a loop always removing the child with index 0.
This, however, results in copying the last child's pinfo in
chld_procs to position 0.  Do this for 100 children and you
get 99 entirely useless copy operations.

Fix this by calling remove_proc in reverse order.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: sigproc: fix minor formatting issue
Corinna Vinschen [Fri, 28 Aug 2020 13:40:16 +0000 (15:40 +0200)]
Cygwin: sigproc: fix minor formatting issue

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: select: Fix a bug on closing pi->bye event.
Takashi Yano via Cygwin-patches [Thu, 27 Aug 2020 09:46:20 +0000 (18:46 +0900)]
Cygwin: select: Fix a bug on closing pi->bye event.

- Close event handle pi->bye only if it was created.
  Addresses:
  https://cygwin.com/pipermail/cygwin-developers/2020-August/011948.html

3 years agoCygwin: sigproc: Allow more child processes per process
Corinna Vinschen [Fri, 28 Aug 2020 13:22:58 +0000 (15:22 +0200)]
Cygwin: sigproc: Allow more child processes per process

256 children per process is a bit tight in some scenarios.

Fix this by revamping the `procs' array.  Convert it to an
extensible class child_procs and rename procs to chld_procs.
Fix code throughout to use matching class methods rather than
direct access.

To allow a lot more child processes while trying to avoid
allocations at DLL startup, maintain two arrays within class
child_procs, one using a default size for 255 (i686) or 1023
(x86_64) children, the other, dynamically allocated on overflowing
the first array, giving room for another 1023 (i686) or 4095
(x86_64) processes.

On testing with a simple reproducer on a x86_64 machine with
4 Gigs RAM, a system memory overflow occured after forking
about 1450 child processes, so this simple dynamic should
suffice for a while.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: drop PROC_DETACHED_CHILD flag
Corinna Vinschen [Fri, 28 Aug 2020 09:10:48 +0000 (11:10 +0200)]
Cygwin: drop PROC_DETACHED_CHILD flag

pinfo::remember with the detach parameter set to true is
the only way to call proc_subproc with PROC_DETACHED_CHILD.
This call is exclusively used in spawn to set up a pinfo for
a detached child, and that pinfo goes out of scope right
afterwards without any further action.

Drop the flag and drop the detach parameter from pinfo::remember.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: sigproc: drop __stdcall
Corinna Vinschen [Thu, 27 Aug 2020 19:56:43 +0000 (21:56 +0200)]
Cygwin: sigproc: drop __stdcall

Nothing to gain here

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: sigproc: return int from remove_proc
Corinna Vinschen [Thu, 27 Aug 2020 19:48:54 +0000 (21:48 +0200)]
Cygwin: sigproc: return int from remove_proc

The return value is used in a numerical context and remove_proc
already returned inconsistently "true" vs. 0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fix up proc_subproc flags and matching pinfo methods
Corinna Vinschen [Thu, 27 Aug 2020 19:38:50 +0000 (21:38 +0200)]
Cygwin: fix up proc_subproc flags and matching pinfo methods

After patch 23a779bf3d7c2afc9eab88f6b8727c1db5544547
"Cygwin: pinfo: stop remember doing reattach",
PROC_ADDCHILD actually just sets up a new child, mirroring
PROC_DETACHED_CHILD.  The actual attaching of the child is
performed by action PROC_REATTACH_CHILD or pinfo::reattach
respectively.

To better reflect what's going on, rename PROC_REATTACH_CHILD
to PROC_ATTACH_CHILD and rename pinfo::reattach to pinfo::attach.
For better readability change PROC_ADDCHILD to PROC_ADD_CHILD.
Fix comments accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: fhandler_fifo::delete_client_handler: improve efficiency
Ken Brown [Wed, 26 Aug 2020 22:21:20 +0000 (18:21 -0400)]
Cygwin: fhandler_fifo::delete_client_handler: improve efficiency

Delete a client handler by swapping it with the last one in the list
instead of calling memmove.

3 years agowinsup/doc/faq-api.xml(faq.api.timezone): explain time zone updates
Brian Inglis [Thu, 27 Aug 2020 07:17:09 +0000 (01:17 -0600)]
winsup/doc/faq-api.xml(faq.api.timezone): explain time zone updates

based on material from tz@IANA.org mailing list sources

3 years agoCygwin: console: Replace WriteConsoleA() with WriteConsoleW().
Takashi Yano via Cygwin-patches [Thu, 27 Aug 2020 03:35:03 +0000 (12:35 +0900)]
Cygwin: console: Replace WriteConsoleA() with WriteConsoleW().

- To allow sending non-ASCII chars to console, all WriteConsoleA()
  are replaced by WriteConsoleW().
  Addresses:
  https://cygwin.com/pipermail/cygwin-patches/2020q3/010476.html

3 years agodoc: Also update shebang for chapter-texi2docbook.py
Jon Turney [Tue, 25 Aug 2020 16:16:36 +0000 (17:16 +0100)]
doc: Also update shebang for chapter-texi2docbook.py

3 years agowinsup/doc/faq-api.xml, -programming.xml: change Win32 to Windows/API
Brian Inglis [Tue, 25 Aug 2020 12:57:14 +0000 (06:57 -0600)]
winsup/doc/faq-api.xml, -programming.xml: change Win32 to Windows/API

3 years agowinsup/doc/faq-setup.xml, faq-using.xml: update setup FAQ
Brian Inglis [Tue, 25 Aug 2020 12:57:13 +0000 (06:57 -0600)]
winsup/doc/faq-setup.xml, faq-using.xml: update setup FAQ

change all kinds of setup references to "the Cygwin Setup program";
emphasize 64 bit and deemphasize 32 bit;
update options list;
explain why installing everything is now extremely inadvisable, with stats

3 years agoEnabled _CS* defines for RTEMS
Eshan dhawan via Newlib [Mon, 24 Aug 2020 14:43:12 +0000 (20:13 +0530)]
Enabled _CS* defines for RTEMS

Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
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.

This page took 0.074121 seconds and 5 git commands to generate.