]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
21 months agoCOPYING.NEWLIB: Arm licence entry amendment
Victor L. Do Nascimento [Thu, 19 Jan 2023 17:17:39 +0000 (17:17 +0000)]
COPYING.NEWLIB: Arm licence entry amendment

Add relevant SPDX-License-Identifier to Arm licence entry in
COPYING.NEWLIB.

21 months agoNEWS: report arm ABI break
Victor L. Do Nascimento [Thu, 19 Jan 2023 17:19:09 +0000 (17:19 +0000)]
NEWS: report arm ABI break

Add details of ABI-conformance fix to setjmp implementation under
Major changes in newlib version 4.3.0

21 months agoNEWS: Add news items
Sebastian Huber [Thu, 19 Jan 2023 18:38:42 +0000 (19:38 +0100)]
NEWS: Add news items

21 months agoCygwin: Add 3.4.5 release message
Corinna Vinschen [Thu, 19 Jan 2023 17:33:40 +0000 (18:33 +0100)]
Cygwin: Add 3.4.5 release message

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: fix build of cygcheck and strace
Corinna Vinschen [Thu, 19 Jan 2023 17:24:15 +0000 (18:24 +0100)]
Cygwin: fix build of cygcheck and strace

adding <target>_LDFLAGS overrides AM_LDFLAGS and thus fails to
build cygcheck and strace statically.  Fix it.

Fixes: 8d318bf142f7 ("Cygwin: disable high-entropy VA for cygcheck and strace")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: dsp: Fix a problem that fcntl() does not take effect.
Takashi Yano [Thu, 19 Jan 2023 13:02:47 +0000 (22:02 +0900)]
Cygwin: dsp: Fix a problem that fcntl() does not take effect.

Previously, fhandler_dev_dsp (OSS) has a problem that fcntl() does
not take effect at all. This patch fixes the issue.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: fix two comments in heap.cc and memory_layout.h
Corinna Vinschen [Wed, 18 Jan 2023 19:07:54 +0000 (20:07 +0100)]
Cygwin: fix two comments in heap.cc and memory_layout.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: memory_init: initialize user heap here
Corinna Vinschen [Wed, 18 Jan 2023 19:07:10 +0000 (20:07 +0100)]
Cygwin: memory_init: initialize user heap here

Eventually move user heap initialization to memory_init.
The call order is not changed. Drop a now useless comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: open_shared: always bump next_address
Corinna Vinschen [Wed, 18 Jan 2023 18:59:48 +0000 (19:59 +0100)]
Cygwin: open_shared: always bump next_address

The new loop in open_shared has a subtil performance problem.
Next_address is bumped only if mapping at this address
failed.  Every subsequent call to open_shared has a high probability
having to call MapViewOfFileEx twice, because next_address is still
set to the address of the last successful mapping.

Avoid this by bumping next_address every time.

While at it, fix a comment.

Fixes: dc0fe7742b8c ("Cygwin: open_shared: try harder allocating a shared region")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoamdgcn: Add vectorized math routines
Kwok Cheung Yeung [Fri, 2 Dec 2022 20:00:11 +0000 (20:00 +0000)]
amdgcn: Add vectorized math routines

This implements a set of vectorized math routines to be used by the
compiler auto-vectorizer.  Versions for vectors with 2 lanes up to
64 lanes (in powers of 2) are provided.

These routines are based on the scalar versions of the math routines in
libm/common, libm/math and libm/mathfp.  They make extensive use of the GCC
C vector extensions and GCN-specific builtins in GCC.

21 months agoCygwin: drop fixed addresses for standard shared regions
Corinna Vinschen [Wed, 18 Jan 2023 12:16:50 +0000 (13:16 +0100)]
Cygwin: drop fixed addresses for standard shared regions

With the previous commit 9ddd48ee1b8d ("Cygwin: /proc/<PID>/maps:
print real shared region addresses"), the real addresses of
the standard shared regions (cygwin, user, myself, shared console)
are read from the printed process itself.  We don't need fixed
addresses anymore, so drop the definitions and simplify open_shared.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: /proc/<PID>/maps: print real shared region addresses
Corinna Vinschen [Tue, 17 Jan 2023 20:58:06 +0000 (21:58 +0100)]
Cygwin: /proc/<PID>/maps: print real shared region addresses

So far, the addresses printed for the shared regions of a process
were faked.  The assumption was that the shared regions are always
in the same place in all processes, so we just printed the addresses
of the current process.  This is no safe bet.  The only safe bet is
the address of the cygheap.  So keep track of the addresses in the
cygheap and read the addresses from the cygheap of the observed
processes.  Add output for the shared console.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: disable high-entropy VA for cygcheck and strace
Corinna Vinschen [Tue, 17 Jan 2023 16:43:21 +0000 (17:43 +0100)]
Cygwin: disable high-entropy VA for cygcheck and strace

It's not a good idea to enable high-entropy VA for tools loading the
Cygwin DLL dynamically.  The addresses used by HEVA tend to collide with
fixed address areas managed by Cygwin.

Fixes: 60675f1a7eb2 ("Cygwin: decouple shared mem regions from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: open_shared: try harder allocating a shared region
Corinna Vinschen [Tue, 17 Jan 2023 09:18:51 +0000 (10:18 +0100)]
Cygwin: open_shared: try harder allocating a shared region

For fixed regions (cygwin/user/myself/shared console), try fixed
address first.  Fallback to non-fixed region.  Don't even try fixed
address if the Cygwin DLL gets dynamically loaded.

For non-fixed regions, try to allocate in a loop within the area
from SHARED_REGIONS_ADDRESS_LOW to SHARED_REGIONS_ADDRESS_HIGH.

Fixes: 60675f1a7eb2 ("Cygwin: decouple shared mem regions from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: Move shared regions, rename PINFO... to MYSELF_REGION_ADDRESS
Corinna Vinschen [Mon, 16 Jan 2023 21:20:48 +0000 (22:20 +0100)]
Cygwin: Move shared regions, rename PINFO... to MYSELF_REGION_ADDRESS

Fix comments accordingly.

This is in preparation for a change in open_shared, handling shared
regions more cleanly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: open_shared: don't reuse shared_locations parameter as output
Corinna Vinschen [Mon, 16 Jan 2023 21:25:42 +0000 (22:25 +0100)]
Cygwin: open_shared: don't reuse shared_locations parameter as output

For ages, open_shared uses the shared_locations parameter as
output to indicate if the mapping for a shared region has been
created or just opened.  Split this into two parameters.  Use
the shared_locations parameter as input only, return the creation
state of the mapping in a bool reference parameter.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: autoload: clean up arguments to LoadDllFunc*
Corinna Vinschen [Tue, 17 Jan 2023 15:28:01 +0000 (16:28 +0100)]
Cygwin: autoload: clean up arguments to LoadDllFunc*

The number of args multiplied by 4 was only required for
32 bit x86 to construct the symbol name correctly.  Drop it.

In the assembler code, split the numerical values for "notimp"
and "err" into half words for cleaner layout.

Fix description accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: /proc/cpuinfo: always print trailing empty line, as on Linux
Corinna Vinschen [Mon, 16 Jan 2023 20:40:59 +0000 (21:40 +0100)]
Cygwin: /proc/cpuinfo: always print trailing empty line, as on Linux

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: /proc/cpuinfo: Always print topology info
Corinna Vinschen [Mon, 16 Jan 2023 13:23:38 +0000 (14:23 +0100)]
Cygwin: /proc/cpuinfo: Always print topology info

vmstat from proc-ps-4.0.x prints "Unable to create system stat structure"
if the /proc/cpuinfo output fails to contain topology info.  While
Linux always prints topology info if the kernel has been built with
CONFIG_SMP, Cygwin only prints topology info if the CPU is known to
be multi-core (i. e., the HT feature flag is set).

Fix that by printing topology info all the time, even for single-core
CPUs.

Fixes: e0d48debedfa ("Fix /proc/cpuinfo topology and cache size info")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: newgrp: improve doumentation
Corinna Vinschen [Sat, 14 Jan 2023 19:13:54 +0000 (20:13 +0100)]
Cygwin: newgrp: improve doumentation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: add newgrp(1) to release message for 3.5.0
Corinna Vinschen [Sat, 14 Jan 2023 17:00:35 +0000 (18:00 +0100)]
Cygwin: add newgrp(1) to release message for 3.5.0

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: newgrp: first full version
Corinna Vinschen [Sat, 14 Jan 2023 16:46:55 +0000 (17:46 +0100)]
Cygwin: newgrp: first full version

- add '-' option
- make group argument optional
- drop ability to take a numerical group argument
- simplify usage output to bare minimum
- Add manpage and documentation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agolibgloss: csky: fix pointer-to-integer warning
Mike Frysinger [Fri, 13 Jan 2023 04:36:07 +0000 (23:36 -0500)]
libgloss: csky: fix pointer-to-integer warning

parameters is an array of integers, so assigning NULL (a pointer)
doesn't make sense.  Use 0 instead which produces the same code.

21 months agolibgloss: merge csky into top-level Makefile
Mike Frysinger [Fri, 13 Jan 2023 04:34:59 +0000 (23:34 -0500)]
libgloss: merge csky into top-level Makefile

Avoid a recursive make to speed things up a bit.
A csky-elf build shows installed objects & libs produce same code.

21 months agoCygwin: add very simple newgrp(1) tool
Corinna Vinschen [Fri, 13 Jan 2023 19:59:07 +0000 (20:59 +0100)]
Cygwin: add very simple newgrp(1) tool

This tool allows to change the primary group for a child process.
The new primary group MUST be part of the supplementary group list
of newgrp's user token.

The command started as child process is specified on the command line.
If it's missing, start the user's default shell with the new primary
group.

TODO: Implement '-' option.
      Add command description to documentation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: CI: Run cygserver for tests
Jon Turney [Thu, 1 Sep 2022 13:07:26 +0000 (14:07 +0100)]
Cygwin: CI: Run cygserver for tests

Note that cygserver must be run using the same cygwin1.DLL as test
programs, as they communicate over a named pipe whose name contains the
'installation key' (which is a hash of the cygwin1.dll's path).

We run cygserver via 'cmd' to avoid the special code which handles a
cygwin parent process starting a cygwin child process, which assumes the
same version of cygwin in both.

21 months agoCygwin: testsuite: Drop appending 'ntsec' to CYGWIN in cygrun wrapper
Jon Turney [Tue, 30 Aug 2022 16:08:27 +0000 (17:08 +0100)]
Cygwin: testsuite: Drop appending 'ntsec' to CYGWIN in cygrun wrapper

Don't append 'ntsec' to the CYGWIN env var in the cygrun wrapper. It
doesn't have any effect anymore.

21 months agoCygwin: testsuite: Update pthread tests for default SCHED_FIFO
Jon Turney [Wed, 31 Aug 2022 19:48:08 +0000 (20:48 +0100)]
Cygwin: testsuite: Update pthread tests for default SCHED_FIFO

Update for default (and only) thread scheduler policy is SCHED_FIFO.

21 months agoCygwin: testsuite: Update mutex tests for changed default mutex type
Jon Turney [Wed, 31 Aug 2022 19:32:47 +0000 (20:32 +0100)]
Cygwin: testsuite: Update mutex tests for changed default mutex type

Default mutex type is PTHREAD_MUTEX_NORMAL.

Attempting to unlock an unowned mutex of that type is specified as
undefined behaviour, not returning EPERM.

mutex7e verfies that attempting to unlock an unowned mutex of type
PTHREAD_MUTEX_ERRORCHECK returns EPERM.

21 months agoCygwin: testsuite: 64-bit fixes in pthread testcases
Jon Turney [Wed, 31 Aug 2022 13:53:45 +0000 (14:53 +0100)]
Cygwin: testsuite: 64-bit fixes in pthread testcases

Fix warnings and 64-bit issues in pthread testcases.

See pthread-win32 commit 1183e5ac etc.

21 months agoCygwin: testsuite: Fix compilation warnings
Jon Turney [Tue, 30 Aug 2022 13:22:55 +0000 (14:22 +0100)]
Cygwin: testsuite: Fix compilation warnings

Fix the warnings the previous change surfaces.

See ltp commit d5c2112f for mmap fixes.

21 months agoCygwin: testsuite: Build testcases using automake
Jon Turney [Wed, 24 Aug 2022 15:01:52 +0000 (16:01 +0100)]
Cygwin: testsuite: Build testcases using automake

Build all the testcase executables directly using automake, rather than
passing the compiler information into DejaGnu to have it build them.

(This means you get build avoidance for these executables, so they only
get built once, rather than every time you run the test, and makes it
much easier to run them in isolatation against the installed Cygwin,
which is really nice to have when trying to fix broken tests...)

Rename the 'cygrun' subdirectory to 'mingw', and build all the testsuite
MinGW executables there.

Drop sample-miscompile.c (testing that compile failure is detected is
perhaps useful, but not here...)

21 months agoCygwin: testsuite: automake doesn't define objdir
Jon Turney [Mon, 29 Aug 2022 15:11:59 +0000 (16:11 +0100)]
Cygwin: testsuite: automake doesn't define objdir

objdir isn't a predefined output variable in Automake (any more?), so
this was just using the absolute path /testsuite as the test's temporary
directory.  Use builddir instead.

21 months agolibgloss: csky: use atexit to call fini-array functions.
Xianmiao Qu [Fri, 13 Jan 2023 12:46:47 +0000 (20:46 +0800)]
libgloss: csky: use atexit to call fini-array functions.

__libc_fini_array should be called upon exit to call the
global termination functions in fini-array, use atexit to
register it at __start.

21 months agolibgloss: merge nios2 into top-level Makefile
Mike Frysinger [Thu, 12 Jan 2023 02:11:59 +0000 (21:11 -0500)]
libgloss: merge nios2 into top-level Makefile

Avoid a recursive make to speed things up a bit.
A nios2-elf build shows installed objects & libs produce same code.

21 months agoCygwin: wincap.h: clarify NO_COPY_RO usage
Corinna Vinschen [Thu, 12 Jan 2023 09:51:39 +0000 (10:51 +0100)]
Cygwin: wincap.h: clarify NO_COPY_RO usage

...and drop one unnecessary usage of NO_COPY_RO.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: wincap: make capability flags readonly
Corinna Vinschen [Thu, 12 Jan 2023 09:33:52 +0000 (10:33 +0100)]
Cygwin: wincap: make capability flags readonly

So far the capability bits were stored in the .cygwin_dll_common
R/W section because we overwrite the is_server bit.  Just don't.
Move the bit to class wincapc instead and define all wincaps
bitfields const.

Fixes: 8937c103ed141 ("* wincap.cc (all wincaps): Store in .cygwin_dll_common section same as wincap. Add comment to explain why.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agolibgloss: merge d30v into top-level Makefile
Mike Frysinger [Wed, 14 Dec 2022 23:58:01 +0000 (18:58 -0500)]
libgloss: merge d30v into top-level Makefile

Avoid a recursive make to speed things up a bit.

21 months agolibgloss: merge arc into top-level Makefile
Mike Frysinger [Wed, 14 Dec 2022 23:54:45 +0000 (18:54 -0500)]
libgloss: merge arc into top-level Makefile

Avoid a recursive make to speed things up a bit.

21 months agolibgloss: merge arm into top-level Makefile
Mike Frysinger [Wed, 14 Dec 2022 03:27:35 +0000 (22:27 -0500)]
libgloss: merge arm into top-level Makefile

Avoid a recursive make to speed things up a bit.

21 months agolibgloss: arm: break newlib dependency
Mike Frysinger [Wed, 14 Dec 2022 08:20:32 +0000 (03:20 -0500)]
libgloss: arm: break newlib dependency

The libgloss port has been reaching back into newlib internals for a
single header whose contents have been frozen for almost a decade.
To break this backwards libgloss->newlib dependency, move the acle
header to the srcroot include/ so everyone can use the same copy.

21 months agonewlib: libc: setjmp M-profile PACBTI-enablement
Victor L. Do Nascimento [Tue, 10 Jan 2023 14:02:08 +0000 (14:02 +0000)]
newlib: libc: setjmp M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.  Save the PAC value in the jump buffer so that
longjmp can only return to the authenticated location.

21 months agonewlib: libc: aeabi_memset M-profile PACBTI-enablement
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:28:01 +0000 (11:28 +0000)]
newlib: libc: aeabi_memset M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

21 months agonewlib: libc: aeabi_memmove M-profile PACBTI-enablement
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:27:01 +0000 (11:27 +0000)]
newlib: libc: aeabi_memmove M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

21 months agonewlib: libc: memcpy M-profile PACBTI-enablement
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:25:36 +0000 (11:25 +0000)]
newlib: libc: memcpy M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

21 months agonewlib: libc: memchr M-profile PACBTI-enablement
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:24:00 +0000 (11:24 +0000)]
newlib: libc: memchr M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

21 months agonewlib: libc: strlen M-profile PACBTI-enablement
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:22:36 +0000 (11:22 +0000)]
newlib: libc: strlen M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

This patch enables PACBTI for all relevant variants of strlen:
     * Newlib for armv8.1-m.main+pacbti
     * Newlib for armv8.1-m.main+pacbti+mve
     * Newlib-nano

21 months agonewlib: libc: strcmp M-profile PACBTI-enablement
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:21:22 +0000 (11:21 +0000)]
newlib: libc: strcmp M-profile PACBTI-enablement

Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

This patch enables PACBTI for all relevant variants of strcmp:
     * Newlib for armv8.1-m.main+pacbti
     * Newlib for armv8.1-m.main+pacbti+mve
     * Newlib-nano

21 months agonewlib: libc: define M-profile PACBTI-enablement macros
Victor L. Do Nascimento [Wed, 21 Dec 2022 11:19:59 +0000 (11:19 +0000)]
newlib: libc: define M-profile PACBTI-enablement macros

Augment the arm_asm.h header file to simplify function prologues and
epilogues whilst adding support for PACBTI enablement via macros for
hand-written assembly functions.  For PACBTI, both prologues/epilogues
as well as cfi-related directives are automatically amended
accordingly, depending on the compile-time mbranch-protection argument
values.

It defines the following preprocessor macros:
   * HAVE_PAC_LEAF: Indicates whether pac-signing has been requested for
   leaf functions.
   * PAC_LEAF_PUSH_IP: Whether leaf functions should push the pac code
   to the stack irrespective of whether the ip register is clobbered in
   the function or not.
   * STACK_ALIGN_ENFORCE: Whether a dummy register should be added to
   the push list as necessary in the prologue to ensure stack
   alignment preservation at the start of assembly function.  The
   epilogue behavior is likewise affected by this flag, ensuring any
   pushed dummy registers also get popped on function return.

It also defines the following assembler macros:
   * prologue: In addition to pushing any callee-saved registers onto
   the stack, it generates any requested pacbti instructions.
   Pushed registers are specified via the optional `first', `last',
   `push_ip' and `push_lr' macro argument parameters.
   when a single register number is provided, it pushes that
   register.  When two register numbers are provided, they specify a
   rage to save.  If push_ip and/or push_lr are non-zero, the
   respective registers are also saved.  Stack alignment is requested
   via the `align` argument, which defaults to the value of
   STACK_ALIGN_ENFORCE, unless manually overridden.

   For example:

       prologue push_ip=1 -> push {ip}
       prologue push_ip=1, align8=1 -> push {r2, ip}
       prologue push_ip=1, push_lr=1 -> push {ip, lr}
       prologue 1 -> push {r1}
       prologue 1, align8=1 -> push {r0, r1}
       prologue 1 push_ip=1 -> push {r1, ip}
       prologue 1 4 -> push {r1-r4}
       prologue 1 4 push_ip=1 -> push {r1-r4, ip}

   * epilogue: pops registers off the stack and emits pac key signing
   instruction, if requested. The `first', `last', `push_ip',
   `push_lr' and `align' function as per the prologue macro,
   generating pop instead of push instructions.

   Stack alignment is enforced via the following helper macro
   call-chain:

{prologue|epilogue} ->_align8 -> _preprocess_reglist ->
  _preprocess_reglist1 -> {_prologue|_epilogue}

   Finally, the necessary cfi directives for adding debug information
   to prologue and epilogue are generated via the following macros:

   * cfisavelist - prologue macro helper function, generating
   necessary .cfi_offset directives associated with push instruction.
   Therefore, the net effect of calling `prologue 1 2 push_ip=1' is
   to generate the following:

       push {r1-r2, ip}
       .cfi_adjust_cfa_offset 12
       .cfi_offset 143, -4
       .cfi_offset 2, -8
       .cfi_offset 1, -12

   * cfirestorelist - epilogue macro helper function, emitting
   .cfi_restore instructions prior to resetting the cfa offset.  As
   such, calling `epilogue 1 2 push_ip=1' will produce:

        pop {r1-r2, ip}
.cfi_register 143, 12
.cfi_restore 2
.cfi_restore 1
.cfi_def_cfa_offset 0

21 months agoCygwin: ctty: Add comments for the special values: -1 and -2.
Takashi Yano [Tue, 10 Jan 2023 13:04:40 +0000 (22:04 +0900)]
Cygwin: ctty: Add comments for the special values: -1 and -2.

_pinfo::ctty has two special values other than the device id of
the allocated ctty:
-1: CTTY is not initialized yet. Can be associated with the TTY
    which is associated with the session leader.
-2: CTTY has been released by setsid(). Can be associate only with
    new TTY which is not associated with any other session as CTTY,
    but cannot be associate with the TTYs already associated with
    other sessions.
This patch adds the comments in some source files.

Suggested-by: Corinna Vinschen <corinna@vinschen.de>
Signedoff-by: Takashi Yano <takashi.yano@nifty.ne.jp>
21 months agoCygwin: pinfo: Additional fix for CTTY behavior.
Takashi Yano [Mon, 26 Dec 2022 11:50:15 +0000 (20:50 +0900)]
Cygwin: pinfo: Additional fix for CTTY behavior.

The commit 25c4ad6ea52f did not fix the CTTY behavior enough. For
example, in the following test case, TTY will be associated as
a CTTY on the second open() call even though the TTY is already
CTTY of another session. This patch fixes the issue.

  #include <unistd.h>
  #include <sys/fcntl.h>

  int main()
  {
    if (fork () == 0) {
      char *tty = ttyname(0);
      int fd;
      setsid();
      fd = open(tty, O_RDWR);
      close(fd);
      fd = open(tty, O_RDWR);
      usleep (60000000L);
    }
    return 0;
  }

Fixes: 25c4ad6ea52f ("Cygwin: pinfo: Align CTTY behavior to the
statement of POSIX.")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
21 months agoCygwin: cygheap: Initialize myself_pinfo before child_copy().
Takashi Yano [Tue, 10 Jan 2023 12:04:29 +0000 (21:04 +0900)]
Cygwin: cygheap: Initialize myself_pinfo before child_copy().

After the commit 30add3e6b3e3, the problem:
https://cygwin.com/pipermail/cygwin/2022-December/252759.html
occurs rarely. It seems that myself_pinfo should be initialized
where the timing before child_copy() and after cygheap allocation.
This patch moves the initialization there.

Fixes: 30add3e6b3e3 ("Cygwin: exec: don't access cygheap before it's
initialized")
Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
21 months agoCygwin: /proc/<PID>/status: avoid crash computing signal info
Corinna Vinschen [Tue, 10 Jan 2023 10:45:28 +0000 (11:45 +0100)]
Cygwin: /proc/<PID>/status: avoid crash computing signal info

The code computing the mask of pending signals used the per-queued
signal TLS pointer without checking it for NULL.  Fix this by using
the process-wide signal mask in that case.

Fixes: 195169186bfd5 ("Cygwin: wait_sig: allow to compute process-wide mask of pending signals")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: Run testsuite against the just-built DLL
Jon Turney [Fri, 23 Dec 2022 13:05:34 +0000 (13:05 +0000)]
Cygwin: Run testsuite against the just-built DLL

Since 4e7817498efc, we're just running the tests against the installed
DLL.  We're arranging to put the build directory on the path, but since
it doesn't contain cygwin1.dll (since it's built with a different name
and renamed on installation), that doesn't have any effect.

Arrange to place the just-built DLL into a directory which the testsuite
can place on it's path (while running the test, but not while compiling
it).

Also fix any remaining references to cygwin0.dll in testsuite,
documentation and comments.

Fixes: 4e7817498efc ("Cygwin: Makefile: Drop all the "test dll" considerations")
21 months agolibgloss: merge aarch64 into top-level Makefile
Mike Frysinger [Wed, 14 Dec 2022 02:54:54 +0000 (21:54 -0500)]
libgloss: merge aarch64 into top-level Makefile

Avoid a recursive make to speed things up a bit.

21 months agoCygwin: /proc/<PID>/status: simplify code generating signal info
Corinna Vinschen [Mon, 9 Jan 2023 17:02:14 +0000 (18:02 +0100)]
Cygwin: /proc/<PID>/status: simplify code generating signal info

The code generating the signal info in _pinfo::siginfo() and in
commune_process() are doing the same thing.  Create a local static
function commune_process_siginfo() to have the code in one place
only.  Remove a useless sigpending() call.

Fixes: 9a3c058f6612 ("Cygwin: /proc/<PID>/status: Fill SigPnd, SigBlk and SigIgn values with life")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
21 months agoCygwin: reinstantiate exporting _alloca
Corinna Vinschen [Mon, 9 Jan 2023 12:35:32 +0000 (13:35 +0100)]
Cygwin: reinstantiate exporting _alloca

This basically reverts commit 1556b96b1b3b03112f271dfe30e043ed538354fd.

Turns out that _alloca is actually used, for instance, by clang.

22 months agoFix memccpy to handle end char >= x80
CompilerAI Research Group [Tue, 3 Jan 2023 19:45:37 +0000 (14:45 -0500)]
Fix memccpy to handle end char >= x80

- use unsigned char variables for optimized version of memccpy

22 months agoCygwin: CI: Fix thinko of 'ncores' for 'nproc'
Jon Turney [Thu, 1 Sep 2022 13:07:26 +0000 (14:07 +0100)]
Cygwin: CI: Fix thinko of 'ncores' for 'nproc'

22 months agofhandler/proc.cc(format_proc_cpuinfo): add Linux 6.1 cpuinfo
Brian Inglis [Thu, 22 Dec 2022 20:26:09 +0000 (13:26 -0700)]
fhandler/proc.cc(format_proc_cpuinfo): add Linux 6.1 cpuinfo

Intel 0x00000007:1 EAX:26 lam Linear Address Masking (& recent entries)

22 months agoCygwin: Add release message for latest console change.
Takashi Yano [Thu, 22 Dec 2022 14:15:32 +0000 (23:15 +0900)]
Cygwin: Add release message for latest console change.

3721a756b0d8 ("Cygwin: console: Make the console accessible from other
terminals.")

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
22 months agoCygwin: console: Make the console accessible from other terminals.
Takashi Yano [Thu, 22 Dec 2022 12:05:31 +0000 (21:05 +0900)]
Cygwin: console: Make the console accessible from other terminals.

Previously, the console device could not be accessed from other terminals.
Due to this limitation, GNU screen and tmux cannot be opened in console.
With this patch, console device can be accessed from other TTYs, such as
other consoles or ptys. Thanks to this patch, screen and tmux get working
in console.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
22 months agoCygwin: devices: Make generic console devices invisible from pty.
Takashi Yano [Wed, 21 Dec 2022 01:06:10 +0000 (10:06 +0900)]
Cygwin: devices: Make generic console devices invisible from pty.

The devices /dev/conin,conout,console were wrongly visible from ptys,
though they are inaccessible. This is because fhandler_console::exists()
returns true due to existing invisible console. This patch makes these
devices invisible from ptys.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
22 months agoCygwin: pinfo: Align CTTY behavior to the statement of POSIX.
Takashi Yano [Tue, 20 Dec 2022 11:26:36 +0000 (20:26 +0900)]
Cygwin: pinfo: Align CTTY behavior to the statement of POSIX.

POSIX states "A terminal may be the controlling terminal for at most
one session."
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html

However, in cygwin, multiple sessions could be associated with the
same TTY. This patch aligns CTTY behavior to the statement of POSIX.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
22 months agonvptx: Implement '_exit' instead of 'exit'
Thomas Schwinge [Thu, 24 Nov 2022 11:45:15 +0000 (12:45 +0100)]
nvptx: Implement '_exit' instead of 'exit'

... so that all of 'exit', '_exit', '_Exit' work.  'exit' thus becomes the
standard 'newlib/libc/stdlib/exit.c' -- and functions registered via 'atexit'
are now called at return from 'main' or manual 'exit' invocation.

22 months agoCygwin: console: Fix hangup of less on quit after the window is resized.
Takashi Yano [Thu, 22 Dec 2022 11:25:22 +0000 (20:25 +0900)]
Cygwin: console: Fix hangup of less on quit after the window is resized.

https://cygwin.com/pipermail/cygwin/2022-December/252737.html

If the less is started from non-cygwin shell and window size is
changed, it will hang-up when quitting. The cause of the proglem is
that less uses longjump() in signal handler. If the signal handler
is called while cygwin is acquiring the mutex, cygwin loses the
chance to release mutex. With this patch, the mutex is released
just before calling kill_pgrp() and re-acquired when kill_pgrp()
returns.

Reported-by: Gregory Mason <grmason@epic.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
22 months agoremove +x bit on source files
Mike Frysinger [Thu, 22 Dec 2022 03:38:57 +0000 (22:38 -0500)]
remove +x bit on source files

These should never be marked executable as they have no shebang and
are pure source files.

22 months agoCygwin: Makefile: Drop all the "test dll" considerations
Jon Turney [Wed, 21 Dec 2022 13:29:49 +0000 (13:29 +0000)]
Cygwin: Makefile: Drop all the "test dll" considerations

After 90236c3a2cf6, the testsuite is failing, as the cygwin0.dll
referenced by the implib that testsuite programs are linked with doesn't
exist anymore.

We don't need to make and link the testsuite with a specially named DLL,
as the cygwin DLL (since 526b0fbca377) takes into consideration the path
it's executing from to define separate "Cygwin installations", which
don't interact.

Fixes: 90236c3a2cf6 ("Cygwin: Makefile: build new-cygwin1.dll in a single step")
22 months agoCygwin: path_conv: make sure sym.path_flags is always initialized
Corinna Vinschen [Wed, 21 Dec 2022 12:08:39 +0000 (13:08 +0100)]
Cygwin: path_conv: make sure sym.path_flags is always initialized

Commit c1023ee353705 introduced a split between mount flags and
path flags.  It didn't initialize symlink_info::path_flags in
path_conv::check, because that's done in symlink_info::check.

However, there are two code paths expecting symlink_info::path_flags
being already initialized and both skip symlink_info::check.

Make sure symlink_info::path_flags is initalized to 0 early in
path_conv::check.

Fixes: c1023ee353705 ("Cygwin: path_conv: decouple path_types from mount types")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: configure: Add option to disable building 'dumper'
Jon Turney [Tue, 13 Dec 2022 23:17:48 +0000 (23:17 +0000)]
Cygwin: configure: Add option to disable building 'dumper'

Rather than guessing, based on just the presence of libbfd, add an
explicit configuration option, to build dumper or not, defaulting to
building it.

This might have some use when bootstrapping Cygwin for a new
architecture, or when building your own Cygwin-targetted cross-compiler,
rather than installing one from the copr, along with the dependencies of
libbfd.

22 months agoCygwin: FAQ: Mention configure options to build with reduced dependencies
Jon Turney [Tue, 13 Dec 2022 22:22:20 +0000 (22:22 +0000)]
Cygwin: FAQ: Mention configure options to build with reduced dependencies

22 months agoCygwin: x86_64: import swab.S from NetBSD
Corinna Vinschen [Tue, 20 Dec 2022 09:19:23 +0000 (10:19 +0100)]
Cygwin: x86_64: import swab.S from NetBSD

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: x86_64: import latest NetBSD bcopy.S
Corinna Vinschen [Tue, 20 Dec 2022 09:13:38 +0000 (10:13 +0100)]
Cygwin: x86_64: import latest NetBSD bcopy.S

Tweak slightly to allow implementing entire {w}mem{p}{cpy,move}
family:

Add WIDE macro processing for wmem* and POST macro processing for
memp* functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: x86_64: import memchr.S from NetBSD
Corinna Vinschen [Tue, 20 Dec 2022 09:09:01 +0000 (10:09 +0100)]
Cygwin: x86_64: import memchr.S from NetBSD

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: x86_64: import new memset.S from NetBSD
Corinna Vinschen [Tue, 20 Dec 2022 09:03:17 +0000 (10:03 +0100)]
Cygwin: x86_64: import new memset.S from NetBSD

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: add local machine/asm.h header
Corinna Vinschen [Tue, 20 Dec 2022 08:56:39 +0000 (09:56 +0100)]
Cygwin: add local machine/asm.h header

This header supports including BSD assembler sources.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: use .S suffix for assembler files
Corinna Vinschen [Mon, 19 Dec 2022 11:46:53 +0000 (12:46 +0100)]
Cygwin: use .S suffix for assembler files

Automake generates different recipies for .s.o vs. .S.o rules.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: check_reparse_point_target: fix comment format
Corinna Vinschen [Mon, 19 Dec 2022 11:47:42 +0000 (12:47 +0100)]
Cygwin: check_reparse_point_target: fix comment format

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agolibgloss: rs6000: fix incorrect install dir for xil files
Mike Frysinger [Wed, 14 Dec 2022 12:55:49 +0000 (07:55 -0500)]
libgloss: rs6000: fix incorrect install dir for xil files

The install steps were missing the multilib qualifier causing them
to always install in the same location and stomp each other.

22 months agolibgloss: merge arm configure script up a level
Mike Frysinger [Sat, 19 Feb 2022 03:38:41 +0000 (22:38 -0500)]
libgloss: merge arm configure script up a level

Move the minor arm-specific logic to a dedicated variable so we can
merge its configure logic up a level.

22 months agolibgloss: merge aarch64 configure script up a level
Mike Frysinger [Sat, 19 Feb 2022 03:14:13 +0000 (22:14 -0500)]
libgloss: merge aarch64 configure script up a level

Move the minor aarch64-specific logic to a dedicated variable so we can
merge its configure logic up a level.

22 months agolibgloss: drop unused multi-build logic
Mike Frysinger [Wed, 14 Dec 2022 02:12:02 +0000 (21:12 -0500)]
libgloss: drop unused multi-build logic

Now that aarch64 & arm have migrated off this, we can punt it.

22 months agolibgloss: arm: inline multi-build logic
Mike Frysinger [Wed, 14 Dec 2022 02:08:04 +0000 (21:08 -0500)]
libgloss: arm: inline multi-build logic

Since no other port uses this custom libgloss multi-build.in logic,
and it's making things difficult to unify, drop it all.  The set of
installed objects and their content should be the same.

There is a difference in the builds: currently we compile all the
objects in this subdir twice, but only a subset of them use a diff
set of flags, and are actually installed (the librdimon.a and its
objects).  So this change speeds things up by removing the duplicate
compilation.

There is a short term cost in having to duplicate the compile rules
for the files that are different, but this is minor when compared to
being able to delete the unused multi-build logic (which we'll do in
a sep commit), and we'll be able to clean this up when we move the
code to unified automake.

None of this should be confused with the common multilib logic.
This is *multi-build* which is processed in parallel.

22 months agolibgloss: aarch64: delete unused multi-build logic
Mike Frysinger [Wed, 14 Dec 2022 02:04:48 +0000 (21:04 -0500)]
libgloss: aarch64: delete unused multi-build logic

This logic looks like it was copied from the arm port, but it isn't
actually used here.  Since no other port uses this custom libgloss
multi-build.in logic, and it's making things difficult to unify,
and aarch64 isn't even using it, drop it all.  The set of installed
objects and their content should be the same.

Once we move this to unified automake, if we want to readd support
for subdir multi-builds, it'll be a lot easier as we can just add
another set of objects with custom flags.

None of this should be confused with the common multilib logic.
This *multi-build* which is processed in parallel.

22 months agolibc: arm: setjmp.S code cleanup
Victor L. Do Nascimento [Wed, 14 Dec 2022 16:46:33 +0000 (16:46 +0000)]
libc: arm: setjmp.S code cleanup

The code for setjmp and longjmp contains unconditionally-disabled
legacy FPA code.

Given the code is not used by any targets, remove the code.

22 months agoFix a bug in setjmp for MIPS o32/o64 FPXX/FP64
Giovanni Bajo [Sat, 17 Dec 2022 14:47:23 +0000 (15:47 +0100)]
Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64

It seems there is a swapped logic in one of the subcases of
setjmp.S for MIPS: when the FPU registers are 64-bit within
a 32-bit aligned jmp_buf, the code realigns the pointers
before doing 64-bit writes, but the branch logic is swapped:
we must avoid the address adjustement when bit 2 is zero
(that is, the address is already 8-byte aligned).

This always triggers an address error when run, as tested
on a MIPS VR4300 with O64 ABI.

22 months agoFix 3 other instances of Reme typo (should be Remez)
Jeff Johnston [Fri, 16 Dec 2022 19:18:56 +0000 (14:18 -0500)]
Fix 3 other instances of Reme typo (should be Remez)

22 months agoRevert "amdgcn: Add vectorized math routines"
Jeff Johnston [Fri, 16 Dec 2022 17:28:48 +0000 (12:28 -0500)]
Revert "amdgcn: Add vectorized math routines"

This reverts commit 125e39bfea1a39341a60348c93a65cf4894e0f2a.

22 months agoFix a typo in the comment.
Nadav Rotem [Thu, 15 Dec 2022 03:53:47 +0000 (19:53 -0800)]
Fix a typo in the comment.

The implementation of expf() explains how approximation in the range [0 - 0.34] is done. The comment describes the "Reme" algorithm for constructing the polynomial. This is a typo and should be the "Remez" algorithm. The remez algorithm (or minimax) is used to calculate the coefficients of polynomials in other implementations of exp(0 and log().

See more:
https://en.wikipedia.org/wiki/Remez_algorithm

22 months agoamdgcn: Add vectorized math routines
Kwok Cheung Yeung [Fri, 2 Dec 2022 20:00:11 +0000 (20:00 +0000)]
amdgcn: Add vectorized math routines

This implements a set of vectorized math routines to be used by the
compiler auto-vectorizer.  Versions for vectors with 2 lanes up to
64 lanes (in powers of 2) are provided.

These routines are based on the scalar versions of the math routines in
libm/common, libm/math and libm/mathfp.  They make extensive use of the GCC
C vector extensions and GCN-specific builtins in GCC.

22 months agoCygwin: Update 3.4.3 release note
Jon Turney [Fri, 16 Dec 2022 10:34:38 +0000 (10:34 +0000)]
Cygwin: Update 3.4.3 release note

(cherry picked from commit 5366b3403c7008314ec45c1fff042d02df6be41e)

22 months agoRevert "Cygwin: x86_64: add wmemset assembler entry point"
Jon Turney [Fri, 16 Dec 2022 10:21:13 +0000 (10:21 +0000)]
Revert "Cygwin: x86_64: add wmemset assembler entry point"

This reverts commit 188d5f6c9ad5cbbd6f0fcb9aaf15bc9870597910.

(cherry picked from commit 98fa366cb68a0c297bbb4a64a2d86649709aeabb)

22 months agoCygwin: add release message for latest path handling patch
Corinna Vinschen [Wed, 14 Dec 2022 10:57:36 +0000 (11:57 +0100)]
Cygwin: add release message for latest path handling patch

5ba5e09b9d39 ("Cygwin: path handling: never substitute virtual drive with target path")

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agolibgloss: bfin: switch to CPPASCOMPILE for .S->.o
Mike Frysinger [Wed, 14 Dec 2022 09:07:12 +0000 (04:07 -0500)]
libgloss: bfin: switch to CPPASCOMPILE for .S->.o

We're compiling .S files, so use CPPAS instead of CC to compile since
the point of CPPAS is to preprocess+assemble .S files.

22 months agolibc: arm: fix setjmp abi non-conformance
Victor L. Do Nascimento [Tue, 13 Dec 2022 14:51:28 +0000 (14:51 +0000)]
libc: arm: fix setjmp abi non-conformance

As per the arm Procedure Call Standard for the Arm Architecture
section 6.1.2 [1], VFP registers s16-s31 (d8-d15, q4-q7) must be
preserved across subroutine calls.

The current setjmp/longjmp implementations preserve only the core
registers, with the jump buffer size too small to store the required
co-processor registers.

In accordance with the C Library ABI for the Arm Architecture
section 6.11 [2], this patch sets _JBTYPE to long long adjusting
_JBLEN to 20.

It also emits vfp load/store instructions depending on architectural
support, predicated at compile time on ACLE feature-test macros.

[1] https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst
[2] https://github.com/ARM-software/abi-aa/blob/main/clibabi32/clibabi32.rst

22 months agoCygwin: Makefile: build new-cygwin1.dll in a single step
Corinna Vinschen [Tue, 13 Dec 2022 12:28:16 +0000 (13:28 +0100)]
Cygwin: Makefile: build new-cygwin1.dll in a single step

The complicated build routine was only required because we needed
the .cygheap section at the end of the file, and the debug sections
broke this.  Now that the cygheap is out of the way, we really don't
have to do this anymore, and the build can just generate a DLL with
integrated debug info.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: Makefile: only regenerate cygwin_version.c if it changes
Corinna Vinschen [Tue, 13 Dec 2022 12:25:06 +0000 (13:25 +0100)]
Cygwin: Makefile: only regenerate cygwin_version.c if it changes

Make sure to create a new cygwin_version.c if it either doesn't
exist yet, or if it would be different from the former file.
This avoids unnecessary DLL rebuilding.

Fixes: 97eb64b909bc ("Cygwin: uname: generate default release string from git as well")
Fixes: 4949a82cde98 ("Cygwin: uname: fix building in non-git source dir")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agonewlib: info: tweak iconv node to avoid collisions
Mike Frysinger [Sat, 10 Dec 2022 08:27:58 +0000 (03:27 -0500)]
newlib: info: tweak iconv node to avoid collisions

We have "Iconv" and "iconv" nodes which generates Iconv.html and
iconv.html files.  On a case-insensitive filesystem, these collide.
Rename the "Iconv" node to match the chapter name that it's already
using to avoid the issue.

22 months agoCygwin: path handling: never substitute virtual drive with target path
Corinna Vinschen [Mon, 12 Dec 2022 20:56:14 +0000 (21:56 +0100)]
Cygwin: path handling: never substitute virtual drive with target path

Move the drive substitution code after the call to
GetFinalPathNameByHandleW into a local function revert_virtual_drive
and add code to handle non-remote virtual drives, i. e., those
created with the subst command.  (Try to) make sure that virtual
drives are never treated like symlinks.

Fixes: 19d59ce75d53 ("Cygwin: path_conv: Rework handling native symlinks as inner path components")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
22 months agoCygwin: add 3.4.2 release notes
Corinna Vinschen [Sun, 11 Dec 2022 10:45:30 +0000 (11:45 +0100)]
Cygwin: add 3.4.2 release notes

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