]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
3 years agoCygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.
Takashi Yano via Cygwin-patches [Mon, 14 Dec 2020 08:25:33 +0000 (17:25 +0900)]
Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.

- This patch skips unnecessary term_has_pcon_cap() call if pseudo
  console is disabled.

3 years agoFix error in powf for x close to 1 and large y
Fabian Schriever [Fri, 11 Dec 2020 15:57:35 +0000 (16:57 +0100)]
Fix error in powf for x close to 1 and large y

This patch fixes the error found by Paul Zimmermann (see
https://homepages.loria.fr/PZimmermann/papers/#accuracy) regarding x
close to 1 and rather large y (specifically he found the case
powf(0x1.ffffeep-1,-0x1.000002p+27) which returns +Inf instead of the
correct value). We found 2 more values for x which show the same faulty
behaviour, and all 3 are fixed with this patch. We have tested all
combinations for x in [+1.fffdfp-1, +1.00020p+0] and y in
[-1.000007p+27, -1.000002p+27] and [1.000002p+27,1.000007p+27].

3 years agoBump newlib release to 4.0.0
Jeff Johnston [Tue, 17 Nov 2020 21:47:35 +0000 (16:47 -0500)]
Bump newlib release to 4.0.0

3 years agocygwin: use CREATE_DEFAULT_ERROR_MODE in spawn
Jeremy Drake via Cygwin-patches [Wed, 9 Dec 2020 19:27:11 +0000 (11:27 -0800)]
cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn

This allows native processes to get Windows-default error handling
behavior (such as invoking the registered JIT debugger).

3 years agoCygwin: dtable::dup_worker: update comment and debug output
Ken Brown [Mon, 7 Dec 2020 21:19:57 +0000 (16:19 -0500)]
Cygwin: dtable::dup_worker: update comment and debug output

The comment and debug output became obsolete in commit 23771fa1f7 when
dup_worker started calling fhandler_base::clone instead of build_fh_pc
and fhandler_base::operator=.

3 years agoCygwin: Allow to set SO_PEERCRED zero (v2)
Mark Geisert [Mon, 7 Dec 2020 10:29:36 +0000 (02:29 -0800)]
Cygwin: Allow to set SO_PEERCRED zero (v2)

The existing code errors as EINVAL any attempt to set a value for
SO_PEERCRED via setsockopt() on an AF_UNIX/AF_LOCAL socket.  But to
enable the workaround set_no_getpeereid behavior for Python one has
to be able to set SO_PEERCRED to zero.  Ergo, this patch.  Python has
no way to specify a NULL pointer for 'optval'.

This v2 of patch allows the original working (i.e., allow NULL,0 for
optval,optlen to mean turn off SO_PEERCRED) in addition to the new
working described above.  The sense of the 'if' stmt is reversed for
readability.

3 years agoCygwin: Launch cygmagic with bash, not sh
Mark Geisert [Mon, 7 Dec 2020 06:17:15 +0000 (22:17 -0800)]
Cygwin: Launch cygmagic with bash, not sh

On some systems /bin/sh is not /bin/bash and cygmagic has bash-isms in
it.  So even though cygmagic has a /bin/bash shebang, it also needs to be
launched with bash from within Makefile.in.

3 years agoFix trace output for getdomainname()
Anton Lavrentiev via Cygwin-patches [Fri, 4 Dec 2020 22:58:01 +0000 (17:58 -0500)]
Fix trace output for getdomainname()

3 years agowinsup/doc/Makefile.in: create man5 dir and install proc.5
Brian Inglis [Wed, 25 Nov 2020 06:49:31 +0000 (23:49 -0700)]
winsup/doc/Makefile.in: create man5 dir and install proc.5

3 years agospecialnames.xml: add proc(5) Cygwin man page
Brian Inglis [Wed, 25 Nov 2020 06:49:30 +0000 (23:49 -0700)]
specialnames.xml: add proc(5) Cygwin man page

3 years agoCygwin: Fix remaining warnings building path testsuite
Corinna Vinschen [Tue, 1 Dec 2020 09:10:40 +0000 (10:10 +0100)]
Cygwin: Fix remaining warnings building path testsuite

3 years agoCygwin: Fix building of utils testsuite
Jon Turney [Mon, 30 Nov 2020 16:58:02 +0000 (16:58 +0000)]
Cygwin: Fix building of utils testsuite

Avoid referencing undefined max_mount_entry.

3 years agoCygwin: add flag to indicate reparse points unknown to WinAPI
Corinna Vinschen [Wed, 2 Dec 2020 15:12:58 +0000 (16:12 +0100)]
Cygwin: add flag to indicate reparse points unknown to WinAPI

https://cygwin.com/pipermail/cygwin/2020-December/246938.html
reports a problem where, when adding a Cygwin default symlink
to $PATH since Cygwin 3.1.5, $PATH handling appears to be broken.

3.1.5 switched to WSL symlinks as Cygwin default symlinks.

A piece of code in path handling skips resolving reparse points
if they are the last component in the path.  Thus a reparse point
in $PATH is not resolved but converted to Windows path syntax
verbatim.

If you do this with a WSL symlink, certain WinAPI functions fail.
The underlying $PATH handling fails to recognize the reparse
point in $PATH and returns with STATUS_IO_REPARSE_TAG_NOT_HANDLED.
As a result, the calling WinAPI function fails, most prominently
so CreateProcess.

Fix this problem by adding a PATH_REP_NOAPI bit to path_types
and a matching method path_conv::is_winapi_reparse_point().

Right now this flag is set for WSL symlinks and Cygwin AF_UNIX
sockets (new type implemented as reparse points).

The aforementioned code skipping repare point path resolution calls
is_winapi_reparse_point() rather than is_known_reparse_point(),
so now path resolution is only skipped for reparse points known
to WinAPI.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: path.h: add comments to briefly explain path_types
Corinna Vinschen [Wed, 2 Dec 2020 14:57:39 +0000 (15:57 +0100)]
Cygwin: path.h: add comments to briefly explain path_types

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: testsuite: libltp: fix warnings showing up with -Wall
Corinna Vinschen [Wed, 2 Dec 2020 13:12:24 +0000 (14:12 +0100)]
Cygwin: testsuite: libltp: fix warnings showing up with -Wall

This libltp is old as old dirt and still using K&R style.
If it's really to be used again at all, it needs a serious
refresh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: /proc/sys FS: don't export NFS and DFS as block devices
Corinna Vinschen [Tue, 1 Dec 2020 08:37:07 +0000 (09:37 +0100)]
Cygwin: /proc/sys FS: don't export NFS and DFS as block devices

Network filesystems are not block devices.  Apparently this code
hasn't been executed anyway, given how network filesystems are
hidden behind \Device\Mup.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoCygwin: Fix access to block devices below /proc/sys.
Christian Franke [Sat, 28 Nov 2020 21:09:23 +0000 (22:09 +0100)]
Cygwin: Fix access to block devices below /proc/sys.

Use fhandler_dev_floppy instead of fhandler_procsys for such devices.
The read()/write() functions from fhandler_procsys do not ensure
sector aligned transfers and lseek() fails always.

Signed-off-by: Christian Franke <franke@computer.org>
4 years agoCygwin: Have cygmagic not create output if an error occurs
Jon Turney [Thu, 12 Nov 2020 17:58:58 +0000 (17:58 +0000)]
Cygwin: Have cygmagic not create output if an error occurs

Improve the 'cygmagic' script, so it doesn't create the output file if
an error occurs, even in one of the backtick-enclosed pipelines it runs.

4 years agoCygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c
Jon Turney [Thu, 19 Nov 2020 21:38:47 +0000 (21:38 +0000)]
Cygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c

This has an separate, explicit compilation rule which omits CXXFLAGS, so
expected flags like '-g -O2' aren't being used.

4 years agoCygwin: Drop libgmon.a build dependency on gcrt0.o
Jon Turney [Thu, 19 Nov 2020 21:34:44 +0000 (21:34 +0000)]
Cygwin: Drop libgmon.a build dependency on gcrt0.o

libgmon.a depends on gcrt0.o, but doesn't include it.

4 years agoCygwin: pty: Fix minor style issue.
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:04 +0000 (20:03 +0900)]
Cygwin: pty: Fix minor style issue.

4 years agoCygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:03 +0000 (20:03 +0900)]
Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.

- If vim is executed in WSL in mintty, some garbage string caused
  by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
  fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
  output.

4 years agoCygwin: pty: Fix a bug in the code removing "CSI > Pm m".
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:02 +0000 (20:03 +0900)]
Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".

- The code added by 8121b606e843c001d5ca5213d24099e04ebc62ca has a
  bug which fails to remove multiple "CSI > Pm m" sequences. This
  patch fixes the bug.

4 years agoCygwin: Remove surplus autoconf auxiliary files
Jon Turney [Wed, 21 Oct 2020 19:41:58 +0000 (20:41 +0100)]
Cygwin: Remove surplus autoconf auxiliary files

Since we are now only configuring once, in winsup, with
AC_CONFIG_AUX_DIR(..), the auxiliary files are taken from the top-level.

(Previously we had a random assorment of AC_CONFIG_AUX_DIR(..) and
AC_CONFIG_AUX_DIR(../..) in winsup subdirectories, so auxiliary files
would be taken from winsup or the top-level.)

4 years agoCygwin: Remove recursive configure
Jon Turney [Tue, 6 Oct 2020 15:22:02 +0000 (16:22 +0100)]
Cygwin: Remove recursive configure

There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.

The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.

Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.

Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.

Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory.  (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).

Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.

Remove generated configure and aclocal.m4 in subdirectories.

4 years agoCygwin: fhandler_fifo::cleanup_handlers: improve efficiency
Ken Brown [Thu, 19 Nov 2020 20:22:56 +0000 (15:22 -0500)]
Cygwin: fhandler_fifo::cleanup_handlers: improve efficiency

Traverse the fifo_client_handler list from the top down to try to
avoid copying.

4 years agoCygwin: Testsuite Makefile cleanup
Jon Turney [Thu, 12 Nov 2020 15:40:44 +0000 (15:40 +0000)]
Cygwin: Testsuite Makefile cleanup

Drop unused variables CC_FOR_TARGET, GCC_INCLUDE, ALL_CFLAGS
Stop exporting CC, CFLAGS
Drop unused, empty targets force, dll_ofiles, all_target

4 years agoCygwin: Fix 'make check' in utils
Jon Turney [Thu, 12 Nov 2020 14:56:09 +0000 (14:56 +0000)]
Cygwin: Fix 'make check' in utils

This has a test of the path translation code used in various utilities
(mount, cygpath, strace).

MOUNT_BINARY is replaced with the absence of MOUNT_TEXT since 26e0b37e.
The issys member of mnt_t struct was removed in b677a99b.

> $ make check
[...]
> total tests: 63
> pass       : 63 (100.0%)
> fail       : 0 (0.0%)

4 years agoCygwin: Drop duplicate C++ flags used to build utils
Jon Turney [Wed, 11 Nov 2020 14:03:58 +0000 (14:03 +0000)]
Cygwin: Drop duplicate C++ flags used to build utils

'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.

4 years agoCygwin: Use grep in text mode to look for version strings
Jon Turney [Wed, 28 Oct 2020 20:59:53 +0000 (20:59 +0000)]
Cygwin: Use grep in text mode to look for version strings

Invoke grep in text mode when looking for version strings inside the
cygwin DLL, so it outputs something more informative than:

  Binary file ../cygwin/cygwin0.dll matches

4 years agoRISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and...
Kito Cheng [Wed, 18 Nov 2020 03:35:43 +0000 (11:35 +0800)]
RISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and llround[f].

4 years agoRISC-V: Add machine-specific implementation for isnan[f] and copysign[f]
Kito Cheng [Wed, 18 Nov 2020 03:35:42 +0000 (11:35 +0800)]
RISC-V: Add machine-specific implementation for isnan[f] and copysign[f]

4 years agoRISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c
Kito Cheng [Wed, 18 Nov 2020 03:35:41 +0000 (11:35 +0800)]
RISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c

4 years agomalloc/nano-malloc: correctly check for out-of-bounds allocation reqs
Corinna Vinschen [Tue, 17 Nov 2020 09:50:57 +0000 (10:50 +0100)]
malloc/nano-malloc: correctly check for out-of-bounds allocation reqs

The overflow check in mEMALIGn erroneously checks for INT_MAX,
albeit the input parameter is size_t.  Fix this to check for
__SIZE_MAX__ instead.  Also, it misses to check the req against
adding the alignment before calling mALLOc.

While at it, add out-of-bounds checks to pvALLOc, nano_memalign,
nano_valloc, and Cygwin's (unused) dlpvalloc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agoFix return type of __locale_ctype_ptr_l()
Sebastian Huber [Mon, 16 Nov 2020 13:38:22 +0000 (14:38 +0100)]
Fix return type of __locale_ctype_ptr_l()

This prevents warnings like this:

ctype.h:118:9: warning: return discards 'const' qualifier from pointer
  target type

4 years agoCygwin: testsuite: fix insecure usage of printf in libltp
Corinna Vinschen [Mon, 16 Nov 2020 14:55:15 +0000 (15:55 +0100)]
Cygwin: testsuite: fix insecure usage of printf in libltp

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
4 years agolibc/include/newlib.h: Fix C++ compilation issue
Joel Sherrill [Mon, 9 Nov 2020 21:33:02 +0000 (15:33 -0600)]
libc/include/newlib.h: Fix C++ compilation issue

4 years agoCygwin: path_conv::eq_worker: add NULL pointer checks
Ken Brown [Sat, 14 Nov 2020 14:02:43 +0000 (09:02 -0500)]
Cygwin: path_conv::eq_worker: add NULL pointer checks

Don't call cstrdup on NULL pointers.

This fixes a crash that was observed when cloning an fhandler whose
path_conv member had freed its strings.

4 years agoCygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix
Jon Turney [Mon, 9 Nov 2020 13:48:38 +0000 (13:48 +0000)]
Cygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix

4 years agoCygwin: fhandler_fifo: reduce size
Ken Brown [Sun, 8 Nov 2020 17:02:39 +0000 (12:02 -0500)]
Cygwin: fhandler_fifo: reduce size

Replace the 'WCHAR pipe_name_buf[48]' class member by 'PWCHAR
pipe_name_buf', and allocate space for the latter as needed.

Change the default constructor to accommodate this change, and add a
destructor that frees the allocated space.

Also change get_pipe_name and clone to accommodate this change.

4 years agoCygwin: Ensure temporary directory used by tests exists
Jon Turney [Thu, 29 Oct 2020 14:43:32 +0000 (14:43 +0000)]
Cygwin: Ensure temporary directory used by tests exists

By default, libltp tests will create temporary files in a subdirectory
of /tmp, which will (nowadays) be located relative to the test DLL (by
assuming that it is in /bin).  This will evaluate to the directory
$target_builddir/winsup/tmp, which doesn't exist.

The location used for these temporary files can be explicitly controlled
by setting the TDIRECTORY env var.  Arrange to set that env var to the
/cygdrive path of a tmp subdirectory of the build directory.

Unfortunately, libltp doesn't clean the temporary directory if
TDIRECTORY is set, and some tests assume they are started in a clean
directory, so we need to do that in tcl.

4 years agoCygwin: Set PATH for tests to pick up cygwin0.dll
Jon Turney [Wed, 28 Oct 2020 16:14:55 +0000 (16:14 +0000)]
Cygwin: Set PATH for tests to pick up cygwin0.dll

Set the PATH so that tests can pick up cygwin0.dll.  Looks like this was
dropped by accident in 2e488e95 ("Don't rely on in-build tools"), so
restore it as it was prior to 9d89f634.

4 years agoCygwin: Check exit code of a test, rather than stdout
Jon Turney [Fri, 16 Oct 2020 23:36:26 +0000 (00:36 +0100)]
Cygwin: Check exit code of a test, rather than stdout

In winsup.exp, don't consider a command failed if it produced any output
(e.g. if the compiler produced warnings).  Instead check the exit code.

4 years agoCygwin: Use absolute path to libltp includes
Jon Turney [Wed, 28 Oct 2020 20:20:27 +0000 (20:20 +0000)]
Cygwin: Use absolute path to libltp includes

Use an absolute path to libltp includes, to allow for the fact that
we'll be compiling tests in a subdirectory.

4 years agoCygiwn: Detect and use MinGW compilers for testsuite wrappers
Jon Turney [Wed, 28 Oct 2020 19:22:56 +0000 (19:22 +0000)]
Cygiwn: Detect and use MinGW compilers for testsuite wrappers

Drop MINGW_FE, which I can't find any trace of, and instead detect and
use MinGW compilers.

This requires adding AC_CANONICAL_TARGET, to set $target_cpu.

4 years agoCygwin: Define target_builddir autoconf and Makefile variables
Jon Turney [Wed, 28 Oct 2020 19:11:02 +0000 (19:11 +0000)]
Cygwin: Define target_builddir autoconf and Makefile variables

This is now required as cygwin_build is defined in terms of
target_builddir.

(Note that in other subdirectories, the autoconf variable
target_builddir is AC_SUBST-ed as a side-effect of using a macro from
winsup/acinclude.m4, which is perhaps less than ideal)

4 years agoCygwin: Move adding libltp to VPATH after Makefile.common
Jon Turney [Wed, 28 Oct 2020 16:42:09 +0000 (16:42 +0000)]
Cygwin: Move adding libltp to VPATH after Makefile.common

Move adding libltp to the VPATH after Makefile.common, which sets VPATH.

4 years agoCygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning
Jon Turney [Tue, 3 Nov 2020 14:50:40 +0000 (14:50 +0000)]
Cygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning

Avoid a 'Makefile.in seems to ignore the --datarootdir setting' warning
when configuring in testsuite directory.

4 years agoCygwin: Add rule to testsuite Makefile to regenerate it when needed
Jon Turney [Mon, 2 Nov 2020 21:53:37 +0000 (21:53 +0000)]
Cygwin: Add rule to testsuite Makefile to regenerate it when needed

4 years agoCygwin: Always configure in testsuite subdirectory
Jon Turney [Wed, 28 Oct 2020 17:02:40 +0000 (17:02 +0000)]
Cygwin: Always configure in testsuite subdirectory

Doing this properly using AC_CONFIG_SUBDIRS is necessary to get the
correct paths in flags given to the compiler specified in CC/CXX.

4 years agoCygwin: Add testsuite directory to autogen.sh
Jon Turney [Mon, 2 Nov 2020 21:45:07 +0000 (21:45 +0000)]
Cygwin: Add testsuite directory to autogen.sh

Also remove unneeded aclocal.m4 for an old aclocal version.

4 years agoCygwin: FIFO: update_my_handlers: fix handle leak
Ken Brown [Fri, 6 Nov 2020 13:16:45 +0000 (08:16 -0500)]
Cygwin: FIFO: update_my_handlers: fix handle leak

4 years agoFix 32-bit integer overflow when calculating TZ rules
Ivan Grokhotov [Wed, 4 Nov 2020 18:30:58 +0000 (13:30 -0500)]
Fix 32-bit integer overflow when calculating TZ rules

4 years agoCygwin: Drop passing '-c' compiler flag into gentls_offsets
Jon Turney [Mon, 26 Oct 2020 17:53:06 +0000 (17:53 +0000)]
Cygwin: Drop passing '-c' compiler flag into gentls_offsets

That script appends a '-E', since we only use $(CC) to preprocess, and
thus adding '-c' is having no effect.

4 years agoCygwin: Remove rules for building libcygwin_s.a
Jon Turney [Mon, 26 Oct 2020 17:51:32 +0000 (17:51 +0000)]
Cygwin: Remove rules for building libcygwin_s.a

Untouched since added in 66a83f3e, and described as 'non-working'.

4 years agoCygwin: Remove Makefile contents conditional on PREPROCESS, which is never defined
Jon Turney [Mon, 26 Oct 2020 17:48:17 +0000 (17:48 +0000)]
Cygwin: Remove Makefile contents conditional on PREPROCESS, which is never defined

4 years agoCygwin: Drop autoconf variable all_host
Jon Turney [Mon, 26 Oct 2020 13:56:51 +0000 (13:56 +0000)]
Cygwin: Drop autoconf variable all_host

The autoconf variable all_host is used to make building of the stub
library used by the testsuite conditional on not cross-compiling.

Make it unconditional, so we will notice if it's broken when
cross-compiling.

4 years agoCygwin: Remove autoconf variable DLL_NAME
Jon Turney [Fri, 23 Oct 2020 14:33:39 +0000 (15:33 +0100)]
Cygwin: Remove autoconf variable DLL_NAME

Remove autoconf variable DLL_NAME, which has a constant value which is
only used in one place.

4 years agoCygwin: Drop AC_SUBST(build_exeext)
Jon Turney [Wed, 21 Oct 2020 18:59:26 +0000 (19:59 +0100)]
Cygwin: Drop AC_SUBST(build_exeext)

The autoconf variable build_exeext isn't defined, and (since the doc
subdirectory doesn't build any executables) it's value isn't used.

4 years agoCygwin: Remove intro2man.stamp on clean
Jon Turney [Wed, 21 Oct 2020 17:26:58 +0000 (18:26 +0100)]
Cygwin: Remove intro2man.stamp on clean

4 years agoRevert "Cygwin: gendef generates sigfe.s and cygwin.def"
Jon Turney [Wed, 28 Oct 2020 15:31:27 +0000 (15:31 +0000)]
Revert "Cygwin: gendef generates sigfe.s and cygwin.def"

This reverts commit 74a164f1c162645f4389bbd9edb2f89a630853af.

Shame we can't use '&:' for a grouped target here, since that requires
GNU make 4.3

4 years agoRISC-V: Fix wrong including file in s_isinf.c
Kito Cheng [Wed, 28 Oct 2020 15:41:27 +0000 (23:41 +0800)]
RISC-V: Fix wrong including file in s_isinf.c

4 years agoRISC-V: NaN should return 0 for finite[f]
Kito Cheng [Wed, 28 Oct 2020 15:41:26 +0000 (23:41 +0800)]
RISC-V: NaN should return 0 for finite[f]

4 years agoCygwin: Restore setting CC and CXX Makefile variables
Jon Turney [Tue, 27 Oct 2020 15:31:06 +0000 (15:31 +0000)]
Cygwin: Restore setting CC and CXX Makefile variables

b55e3f19 was a bit too aggressive in dropping, rather than just
un-exporting these Makefile variables.  We need to set these to the
configured host compiler if we are cross-compiling, otherwise they
default to the build compiler.

Also export CC to the mkvers.sh script (which requires it since
4eca5e6a).  It's unclear why we can't just cause windres to use the
build 'cpp' as the pre-processor there.

4 years agolibc/sys/rtems/include/machine/_types.h: Define daddr_t to be 64 bits for RTEMS
Joel Sherrill [Tue, 27 Oct 2020 19:07:08 +0000 (14:07 -0500)]
libc/sys/rtems/include/machine/_types.h: Define daddr_t to be 64 bits for RTEMS

This type needs to be able to represent a position on a disk or
file system.

4 years agoCygwin: fix return value of sqrtl on negative infinity
Ken Brown [Tue, 27 Oct 2020 13:52:48 +0000 (09:52 -0400)]
Cygwin: fix return value of sqrtl on negative infinity

The return value is now -NaN.

This fixes a bug in the mingw-w64 code that was imported into Cygwin.
The fix is consistent with Posix and Linux.  It is also consistent
with the current mingw-w64 code, with one exception: The mingw-w64
code sets errno to EDOM if the input is -NaN, but this appears to
differ from Posix and Linux.

Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html

4 years agoCygwin: pty: Disable ResizePseudoConsole() if stdout is redirected.
Takashi Yano via Cygwin-patches [Tue, 27 Oct 2020 08:26:34 +0000 (17:26 +0900)]
Cygwin: pty: Disable ResizePseudoConsole() if stdout is redirected.

- Calling ResizePseudoConsole() generates some escape sequences.
  Due to this behaviour, if the output of non-cygwin app is piped
  to less, screen is sometimes distorted when the screen is resized.
  With this patch, ResizePseudoConsole() is not called if stdout is
  redirected.

4 years agoRISC-V: Implment finite and fpclassify
Kito Cheng [Tue, 27 Oct 2020 06:19:58 +0000 (14:19 +0800)]
RISC-V: Implment finite and fpclassify

4 years agoRISC-V: Add fabs[f], fmax[f] and fmin[f].
Kito Cheng [Tue, 27 Oct 2020 06:19:57 +0000 (14:19 +0800)]
RISC-V: Add fabs[f], fmax[f] and fmin[f].

4 years agoDefine RB_SET_PARENT to do all assignments
dougm [Tue, 23 Jun 2020 20:02:55 +0000 (20:02 +0000)]
Define RB_SET_PARENT to do all assignments

to rb parent pointers. Define RB_SWAP_CHILD to replace the child of a parent
with its twin, and use it in 4 places. Use RB_SET in rb_link_node to remove the
only linuxkpi reference to color, and then drop color- and parent-related
definitions that are defined and used only in rbtree.h.

This is intended to be entirely cosmetic, with no impact on program
behavior, and leave RB_PARENT and RB_SET_PARENT as the only ways to
read and write rb parent pointers.

Reviewed by: markj, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25264

4 years agoIn concluding RB_REMOVE_COLOR, in the case when
dougm [Sat, 20 Jun 2020 20:25:39 +0000 (20:25 +0000)]
In concluding RB_REMOVE_COLOR, in the case when

the sibling of the root of the too-short tree is black and at least one of the
children of that sibling is red, either one or two rotations finish the
rebalancing. In the case when both of the children are red, the current
implementation uses two rotations where only one is necessary. This change
removes that extra rotation, and in that case also removes a needless
black-to-red-to-black recoloring.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25335

4 years agoLinuxkpi uses the rb-tree structures
dougm [Sat, 13 Jun 2020 01:54:09 +0000 (01:54 +0000)]
Linuxkpi uses the rb-tree structures

without using their interfaces, making them break when the representation
changes. Revert changes that eliminated the color field from rb-trees, leaving
everything as it was before.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25250

4 years agoFixup r361997 by balancing parens. Duh.
dougm [Wed, 10 Jun 2020 03:36:17 +0000 (03:36 +0000)]
Fixup r361997 by balancing parens. Duh.

4 years agoRestore an RB_COLOR macro, for the benefit of
dougm [Wed, 10 Jun 2020 02:50:25 +0000 (02:50 +0000)]
Restore an RB_COLOR macro, for the benefit of

a bit of DIAGNOSTIC code that depends on it.

Reported by: rpokala, mjguzik
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25204

4 years agoTo reduce the size of an rb_node, drop the color
dougm [Tue, 9 Jun 2020 20:19:11 +0000 (20:19 +0000)]
To reduce the size of an rb_node, drop the color

field. Set the least significant bit in the pointer to the node from its parent
to indicate that the node is red. Have the tree rotation macros leave the
old-parent/new-child node red and the new-parent/old-child node black.

This change makes RB_LEFT and RB_RIGHT no longer assignable, and
RB_COLOR no longer defined. Any code that modifies the tree or
examines a node color would have to be modified after this change.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25105

4 years agoRemove from RB_REMOVE_COLOR some null checks
dougm [Tue, 2 Jun 2020 17:18:16 +0000 (17:18 +0000)]
Remove from RB_REMOVE_COLOR some null checks

where the pointer checked is provably never null. Restructure the surrounding
code just enough to make the non-nullness obvious.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25089

4 years agoRB_REMOVE invokes RB_REMOVE_COLOR either when
dougm [Sat, 30 May 2020 01:48:12 +0000 (01:48 +0000)]
RB_REMOVE invokes RB_REMOVE_COLOR either when

child is red or child is null. In the first case, RB_REMOVE_COLOR just changes
the child to black and returns. With this change, RB_REMOVE handles that case,
and drops the child argument to RB_REMOVE_COLOR, since that value is always
null.

RB_REMOVE_COLOR is changed to remove a couple of unneeded tests, and
to eliminate some deep indentation.

RB_ISRED is defined to combine a null check with a test for redness,
to replace that combination in several places.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25032

4 years agoFor the case when RB_REMOVE requires a nontrivial
dougm [Thu, 21 May 2020 05:34:02 +0000 (05:34 +0000)]
For the case when RB_REMOVE requires a nontrivial

search to find the node to replace the one being removed, restructure to first
remove the replacement node and correct the parent pointers around it, and then
let the all-cases code at the end deal with the parent of the deleted node,
making it point to the replacement node. This removes one or two conditional
branches.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D24845

4 years agoCorrect the use of RB_AUGMENT in the RB_TREE
dougm [Mon, 27 Jan 2020 15:09:13 +0000 (15:09 +0000)]
Correct the use of RB_AUGMENT in the RB_TREE

macros so that is invoked at the root of every subtree that changes in an
insert or delete, and only once, and ordered from the bottom of the tree to the
top. For intel_gas.c, the only user of RB_AUGMENT I can find, change the
augmenting routine so that it does not climb from entry to tree root on every
call, and remove a 'tree correcting' function that can be supplanted by proper
tree augmentation.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23189

4 years agoAdd RB_REINSERT(3), a low overhead alternative to
trasz [Sat, 28 Sep 2019 09:22:52 +0000 (09:22 +0000)]
Add RB_REINSERT(3), a low overhead alternative to

removing a node and reinserting it back with an updated key.

This is one of dependencies for the upcoming stats(3) code.

Reviewed by: cem
Obtained from: Netflix
MFC after: 2 weeks
Sponsored by: Klara Inc, Netflix
Differential Revision: https://reviews.freebsd.org/D21786

4 years agoamd64: prevent KCSan false positives on LAPIC mapping
jah [Sat, 12 Sep 2020 07:04:00 +0000 (07:04 +0000)]
amd64: prevent KCSan false positives on LAPIC mapping

For configurations without x2APIC support (guests, older hardware), the global
LAPIC MMIO mapping will trigger false-positive KCSan reports as it will appear
that multiple CPUs are concurrently reading and writing the same address.
This isn't actually true, as the underlying physical access will be performed
on the local CPU's APIC. Additionally, because LAPIC access can happen during
event timer configuration, the resulting KCSan printf can produce a panic due
to attempted recursion on event timer resources.

Add a __nosanitizethread preprocessor define to prevent the compiler from
inserting TSan hooks, and apply it to the x86 LAPIC accessors.

PR: 249149
Reported by: gbe
Reviewed by: andrew, kib
Tested by: gbe
Differential Revision: https://reviews.freebsd.org/D26354

4 years agosys: clean up empty lines in .c and .h files
mjg [Tue, 1 Sep 2020 22:12:58 +0000 (22:12 +0000)]
sys: clean up empty lines in .c and .h files

4 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

4 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

4 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

4 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.

4 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.

4 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

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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}

4 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.

4 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)

4 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>
4 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.

4 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

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