This patch is for the sake of gnulib.
gnulib implements some form of a thread-safe setlocale variant
called setlocale_null_r, which is supposed to return the locale
strings in a thread-safe manner. This only succeeds if the system's
setlocale already handles this thread-safe, otherwise gnulib adds
some locking on its own.
Newlib's setlocale always writes the global string array holding the
LC_ALL value anew on each invocation of setlocale(LC_ALL, NULL).
Since that doesn't allow to call setlocale(LC_ALL, NULL) in a
thread-safe manner, so locking in gnulib is required.
And here's the problem...
The lock is decorated as dllexport when building for Cygwin. This
collides with the default behaviour of ld to export all symbols.
If it finds one decorated symbol, it will only export this symbol
to the DLL import lib.
Change setlocale so that it writes the global string array
holding the LC_ALL value at the time the locale gets changed.
On setlocale(LC_ALL, NULL), just return the pointer to the
global LC_ALL string array, just as in GLibc. The burden of
doing so is negligibly for all targets, but adds thread-safety
for gnulib's setlocal_null_r() function, and gnulib can drop
the lock entirely when building for Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
When compiling Newlib for arm targets with GCC 12.1 onward, the
passing of architecture extension information to the assembler is
automatic, making the use of .fpu and .arch_extension directives
in assembly files redundant.
With older versions of GCC, however, these directives must be
hard-coded into the `arm/setjmp.S' file to allow the assembly of
instructions concerning the storage and subsequent reloading of the
floating point registers to/from the jump buffer, respectively.
This patch conditionally adds the `.fpu vfpxd' and `.arch_extension
mve' directives based on compile-time preprocessor macros concerning
GCC version and target architectural features, such that both the
assembly and linking of setjmp.S succeeds for older versions of
Newlib.
A recent binutils version introduced `libsframe` and made it a
dependency of `libbfd`. This caused a linker problem in the MSYS2
project, and once Cygwin upgrades to that binutils version it would
cause the same problems there.
Let's preemptively detect the presence of `libsframe` and if detected,
link to it in addition to `libbfd`.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Previously, SNDCTL_DSP_SETFRAGMENT was just a fake. In this patch,
it has been implemented to allow latency control in some apps.
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
- if the user has no perms to write to /etc/setup, don't try
to fetch user homedir from Cygwin (crashes galore). Use
LOCALAPPDATA path instead.
- info is more rpm like
- print info of installed package
- added info selectors --inst, --curr, --prev, --test
- add installation date
TODO:
- Human-readable filesize
- url and license needs to be added to setup.ini yet
-
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
We don't have floating-point exception or non-default rounding mode
support for the RISC-V soft-float environment, `feraiseexcept' and
`fesetround' do nothing unless the `__riscv_flen' macro has been set.
Therefore following ISO C language requirements[1] only define macros
for soft float that correspond to actually supported floating-point
environment features, removing failures from GCC testing such as:
FAIL: gcc.dg/torture/fp-int-convert-timode-3.c -O0 execution test
FAIL: gcc.dg/torture/fp-int-convert-timode-4.c -O0 execution test
References:
[1] "Programming languages -- C", ISO/IEC 9899:2023, working draft --
September 3, 2022, Section 7.6 "Floating-point environment <fenv.h>"
Fixes: 7040b2de08 ("Add RISC-V port for libm")
Signed-off-by: Maciej W. Rozycki <macro@embecosm.com>
In preparation of new functionality, split fetching data
from cygwin.com out of the package_grep() function.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
fhandler_dev_dsp (OSS) has a problem that waitforallsent(), which is
called from close(), falls into infinite loop if another thread calls
write() accidentally after close(). This patch fixes the issue.
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
The list of invalid chars for server names differs from the
list of invalid chars for share names. Apart from that,
we don't allow control chars in both kinds of names.
Fixes: 6338d2f24a ("Cygwin: mount: allow any valid character in UNC paths")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The current code only allows server and share names to
start with ASCII chars [a-zA-Z0-9],, which is not correct.
Rather, check for a valid share character.
Fixes: 1fd5e000ac ("import winsup-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The commit af8a7c13b5 has a problem that fsync returns EINVAL for
block device. This patch treats block devices as a special case.
https://cygwin.com/pipermail/cygwin/2023-January/252916.html
Fixes: af8a7c13b5 ("Cygwin: fsync: Return EINVAL for special files.")
Reported-by: Yano Ray <yanorei@hotmail.co.jp>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This is still not properly resolving <https://gcc.gnu.org/PR85463>
'[nvptx] "exit" in offloaded region doesn't terminate process', but is
one step into that direction, and allows for simplifying some GCC code.
... as implemented for GCN in 'newlib/libc/sys/amdgcn/*' files, but (for now)
still adding to the catch-all 'newlib/libc/machine/nvptx/misc.c' file.
This is necessary for the GCC/Fortran I/O system, for example.
Co-authored-by: Andrew Stubbs <ams@codesourcery.com>
Such a hard-coded ELIX level restriction is only being applied for nvptx
newlib -- but we'd actually like higher levels' functions available there,
too. (Users continue to be able to override this via newlib 'configure',
as for every other newlib target.)
This already enables GCC test cases that currently FAIL due to
'unresolved symbol strndup' ('gcc.dg/builtin-dynamic-object-size-0.c'), or
'unresolved symbol mempcpy' ('gcc.dg/torture/pr45636.c'), for example.
Co-authored-by: Andrew Stubbs <ams@codesourcery.com>
Given that nvptx newlib currently restricts itself to ELIX level 1, this
is not already a problem. However, in the following we'd like to lift
that restriction, and then run into:
[...]/newlib/libc/ssp/stack_protector.c: In function ‘__stack_chk_init’:
[...]/newlib/libc/ssp/stack_protector.c:31:1: sorry, unimplemented: global constructors not supported on this target
31 | }
| ^
GCC patch "nvptx: Support global constructors/destructors via 'collect2'"
has been posted, but not yet accepted. Until that is resolved, use the
same manual SSP setup as for GCN.
adding <target>_LDFLAGS overrides AM_LDFLAGS and thus fails to
build cygcheck and strace statically. Fix it.
Fixes: 8d318bf142 ("Cygwin: disable high-entropy VA for cygcheck and strace")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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>
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>
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: dc0fe7742b ("Cygwin: open_shared: try harder allocating a shared region")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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.
With the previous commit 9ddd48ee1b ("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>
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>
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: 60675f1a7e ("Cygwin: decouple shared mem regions from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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: 60675f1a7e ("Cygwin: decouple shared mem regions from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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>
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>
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>
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: e0d48debed ("Fix /proc/cpuinfo topology and cache size info")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- 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>