Commit Graph

21077 Commits

Author SHA1 Message Date
Corinna Vinschen b5f9b0241a Cygwin: is_unicode_equiv: implement Unicode equivalence class check
is_unicode_equiv compares two UTF-32 values and returns 1 if
both are member of the same Unicode equivalence class, 0 otherwise.

Note that this function only works with precomposed characters
per Unicode normalization form C.  It doesn't handle decomposed
characters, just like its counterpart in glibc.  I.e., equivalence
class comparison using decomposed chars won't work.  Example:

  fnmatch("[=n=]", "ñ") == 0
  fnmatch("[=ñ=]", "n") == 0

but

  fnmatch("[=n=]", "n\x0303") == 1
  fnmatch("[=n\x0303=]", "n") == 1
  fnmatch("[=n\x0303=]", "n\x0303") == 1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-15 22:00:39 +01:00
Corinna Vinschen be67844f5d Cygwin: Makefile.am: fix rule to create version from git describe
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-15 15:04:16 +01:00
Corinna Vinschen 65446dd4f0 Cygwin: add glob/fnmatch named class support to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-15 14:22:26 +01:00
Corinna Vinschen d6d4436145 Cygwin: glob: handle named character classes
Handle [:<character-class>:] expressions in range brackets.

TODO: Collating symbols [.<collsym>'.] and Equivalence class
expressions [=<equiv-class>=] are recognized but skipped as if
they are not present at all.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-15 14:11:45 +01:00
Corinna Vinschen 7faa646553 Cygwin: fnmatch: handle named character classes
Handle [:<character-class>:] expressions in range brackets.

TODO: Collating symbols [.<collsym>'.] and Equivalence class
expressions [=<equiv-class>=] are recognized but skipped as if
they are not present at all.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 20:22:54 +01:00
Corinna Vinschen 1fc35f30bd Cygwin: mbrtowi: fix return type
bad typo: change wint_t to size_t

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 20:18:42 +01:00
Jon Turney 1387ea9f98
Cygwin: dumper: also link with libzstd, as libbfd may require it
Also allow that linkage to be dynamic, as libzstd-devel doesn't
currently provide a static library.
2023-02-14 14:37:32 +00:00
Corinna Vinschen 588624da2b Cygwin: regex: convert wchar_t to wint_t
- call mbrtowi instead of mbrtowc
- drop Cygwin-only surrogate handling from wgetnext and xmbrtowc since
  it's encapsulated in mbrtowi.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 13:02:15 +01:00
Corinna Vinschen 0321fb5736 Cygwin: glob: convert wchar_t to wint_t
...thus handling all Unicode values sanely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 12:48:31 +01:00
Corinna Vinschen 99da4956c5 Cygwin: fnmatch: convert wchar_t to wint_t
...thus handling all Unicode values sanely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 12:48:31 +01:00
Corinna Vinschen eac830e0fe Cygwin: __collate_range_cmp: handle Unicode values >= 0x10000
So far the input to __collate_range_cmp was handled as a wchar_t.
Change that to handle it as wint_t holding a UTF-32 value and
add creating surrogate pairs for the call to wcscoll.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 12:48:26 +01:00
Corinna Vinschen 60c25da90d Cygwin: mbrtowi: define replacement for mbrtowc, returning UTF-32 value
Given how UTF-16 isn't capable to hold all Unicode chars in a single
wchar_t, we need a function returning a wint_t value representing
a UTF-32 value for comparison functions.  Fortunately the important
wide character functions like towupper/towlower, isw<class>, iswctype,
etc, already take wint_t values and newlib handles them as UTF-32.

If only we had switched wchar_t to 32 bit way back when... sigh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-14 12:20:20 +01:00
Corinna Vinschen 210eca1b31 Cygwin: socket.h: define missing IPTOS_LOWCOST/IPTOS_MINCOST
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-12 21:42:26 +01:00
Corinna Vinschen f307fefe16 Cygwin: cygcheck: fix default info selector evaluation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-11 12:58:13 +01:00
Corinna Vinschen b030a77dff Cygwin: cygcheck: fix dependency search
Spaces are filtered out by PathMatchSpecA so they can't
be used as pattern anchors.  Overwrite all spaces with
commas and fix the search expresion accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-11 12:53:34 +01:00
Corinna Vinschen 498fce80ef Cygwin: get_posix_access: Make mode_t parameter mandatory
Avoid the mistake fixed in the preceeding commit by passing
the mode_t argument by reference.  This also affects a couple
other functions calling get_posix_access in turn.

Fixes: bc444e5aa4 ("Reapply POSIX ACL changes.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-09 21:58:44 +01:00
Corinna Vinschen 9afd4c0558 Cygwin: chmod: don't drop default ACEs from directory ACLs
commit bc444e5aa4 introduced a call to get_posix_access()
with a NULL pointer for the mode_t parameter because the value
is not needed later on... entirely ignoring the fact that the
mode_t bits are checked for the object being a directory.

In turn, the get_posix_access() call never checked for default
ACEs and returned only the standard ACEs.  Thus, every chmod call
on a directory dropped the default ACEs from its permissions, as
well as the default NULL deny-ACE used to store specific bits.
It got also impossible to set the sgid bit on directories.

Fixes: bc444e5aa4 ("Reapply POSIX ACL changes.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-09 21:58:20 +01:00
Corinna Vinschen 283583c5f2 Cygwin: mkdir: use correct default permissions filtered by umask
Older coreutils created directories with mode bits filtered through
umask.  Newer coreutils creates directories with full permissions,
0777 by default.

This new coreutils behaviour uncovered the fact that default ACEs for
newly created directories were not filtered by umask starting with
commit bc444e5aa4.

Fix it by applying umask on the default ACEs.

Fixes: bc444e5aa4 ("Reapply POSIX ACL change.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-09 21:58:07 +01:00
Corinna Vinschen dc70c8dec1 Cygwin: cygcheck: improve OS output
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-09 14:41:12 +01:00
Corinna Vinschen 2a683f84a1 Cygwin: cygcheck: add dependency output
-e --requires   search packages depending on packages given as PATTERN
-e --build-reqs search packages with build dependency matching PATTERN

-i --depends    print dependencies
-i --build-deps print build dependencies (if available)

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-08 21:05:18 +01:00
Corinna Vinschen a022a8efd7 Cygwin: cygcheck: print categories in --info output
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-08 20:43:15 +01:00
Corinna Vinschen 627c0f2b67 Cygwin: cygcheck: collect build-depends info
TODO: implement options to print all deps, all build-deps,
all packages depending on packages matching the search string
and so on.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-07 22:49:38 +01:00
Corinna Vinschen 013ccc0686 Cygwin: cygcheck: add latest product codes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-07 22:21:05 +01:00
Corinna Vinschen 23e49b18ce setlocale: create LC_ALL string when changing locale
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>
2023-02-06 16:04:33 +01:00
Victor L. Do Nascimento c6e601de84 libc: arm: Implement setjmp GCC backwards compatibility.
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.
2023-02-03 13:07:08 +00:00
Johannes Schindelin 89f930a964 dumper: avoid linker problem when `libbfd` depends on `libsframe`
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>
2023-02-01 20:00:01 +01:00
Takashi Yano 3a4c740f59 Cygwin: dsp: Implement SNDCTL_DSP_SETFRAGMENT ioctl().
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>
2023-01-31 20:35:53 +09:00
Corinna Vinschen 4b157b44ca Cygwin: cygcheck: lower setup.ini expiration time to 3 hours
...as is default for dnf

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-29 21:32:25 +01:00
Corinna Vinschen 37c5b6d929 Cygwin: cygcheck: find_url: fix error handling
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-29 20:35:45 +01:00
Corinna Vinschen c061551c67 Cygwin: add new cygcheck capabilities to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-29 18:40:14 +01:00
Corinna Vinschen 784a141e0f Cygwin: cygcheck: improve documentation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-29 17:52:13 +01:00
Corinna Vinschen 603f880cb7 Cygwin: cygcheck: simplify output when fetching setup.ini
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-29 17:51:42 +01:00
Corinna Vinschen c67e6570ee Cygwin: cygcheck: add human readable package size output
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-29 17:21:28 +01:00
Corinna Vinschen 022665af17 Cygwin: cygcheck: package info / available package search, take 2
- 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>
2023-01-29 14:13:25 +01:00
Corinna Vinschen 76d2053ec8 Cygwin: cygcheck: package info / available package search, take 1
cygcheck -i == dnf info <pattern...>
cygcheck -e == dnf search <pattern...>

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-28 14:59:39 +01:00
Maciej W. Rozycki 963d6c79ea RISC-V: Fix floating-point environment support for soft float
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>
2023-01-27 14:25:44 +01:00
Corinna Vinschen 28594480df Cygwin: cygcheck: split out fetching data from cygwin.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>
2023-01-26 19:58:30 +01:00
Takashi Yano bf91542004 Cygwin: dsp: Fix hang on close() if another thread calls write().
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>
2023-01-26 02:04:18 +09:00
Corinna Vinschen cad3913ed8 Cygwin: mount: differ allowed server name chars from allowed share name chars
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>
2023-01-23 14:02:20 +01:00
Corinna Vinschen 6338d2f24a Cygwin: mount: allow any valid character in UNC paths
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>
2023-01-22 20:15:37 +01:00
Takashi Yano bdb9f5b173 Cygwin: fsync: Fix EINVAL for block device.
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>
2023-01-22 19:01:34 +09:00
Corinna Vinschen 3123fdeecb Cygwin: tape: tapes are character devices, not block devices
Fixes: 727a81f4d9 ("* devices.h (device::exists_func): Redefine field.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-21 18:25:56 +01:00
Jeff Johnston 9e09d6ed83 Bump up newlib to 4.3.0 2023-01-20 16:01:54 -05:00
Thomas Schwinge 05a2d7a8b3 nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]
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.
2023-01-19 21:53:02 +01:00
Thomas Schwinge 29b137af80 nvptx: Provide stub 'getpid', 'kill', 'stat'
... 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>
2023-01-19 21:52:50 +01:00
Thomas Schwinge 654072d7a2 nvptx: Remove newlib ELIX level 1 restriction
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>
2023-01-19 21:52:06 +01:00
Thomas Schwinge 3b58032de1 nvptx: Don't use global constructor for SSP setup
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.
2023-01-19 21:51:09 +01:00
Thomas Schwinge 52cb937004 nvptx: Provide stub 'gettimeofday'
Instead of them FAILing due to 'unresolved symbol gettimeofday', this
makes PASS a number of GCC 'gfortran.dg' test cases, for example.
2023-01-19 21:50:57 +01:00
Jeff Johnston 8af65b8c14 Add amdgcn vectorized math routines to NEWS 2023-01-19 15:14:44 -05:00
Victor L. Do Nascimento a7be7d8b75 COPYING.NEWLIB: Arm licence entry amendment
Add relevant SPDX-License-Identifier to Arm licence entry in
COPYING.NEWLIB.
2023-01-19 15:05:05 -05:00