Jeremy Drake [Sat, 28 Jun 2025 00:16:51 +0000 (17:16 -0700)]
Cygwin: add pgroup support to posix_spawn fast path
Tweak proc_subproc PROC_ADD_CHILD to only initialize vchild->pgid if
it's not already set.
The error checking of setpgid is lacking with respect to the POSIX
standard, but this code replicates what setpgid does.
This attribute is used by ninja, so is worth adding to the fast path.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Tue, 24 Jun 2025 05:59:55 +0000 (22:59 -0700)]
Cygwin: posix_spawn: add fastpath support for SETSIGMASK and SETSIGDEF.
the sigmask was already a member of the child_info, so this just needed
an arg to allow overriding the value copied from cygheap. The signal
handlers are referenced by two pointers, global_sigs which is used by
the signal routines, and cygheap->sigs which is only used during process
launch and startup. Temporarily replace cygheap->sigs with a copy that
has the requested signals reset to default while spawning the child.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Wed, 28 May 2025 20:55:34 +0000 (13:55 -0700)]
Cygwin: add fast-path for posix_spawn(p)
Currently just file actions are supported in the fast path, open/dup2
with a target fd of stdin/out/err, close of any fd, and chdir and
fchdir. These were chosen as the least-common-denominator of
functionality supported for any child process, as they are allowed to be
specified via CreateProcess. They also happen to be the most common
file operations, performed by the likes of GNU make, ninja, LLVM, and rust.
For other attributes or actions, fall back to the newlib implementation
of posix_spawn (which uses fork/exec to set everything up in the child
process).
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Wed, 28 May 2025 19:52:26 +0000 (12:52 -0700)]
Cygwin: hook posix_spawn/posix_spawnp
This will allow checking for and optimizing cases that can easily be
implemented using ch_spawn instead of using a full fork/exec.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Thu, 26 Jun 2025 21:29:11 +0000 (14:29 -0700)]
Cygwin: add ability to pass cwd to child process
This will be used by posix_spawn_fileaction_add_(f)chdir.
The int cwdfd is placed such that it fits into space previously unused
due to alignment in the cygheap_exec_info class.
This uses a file descriptor rather than a path both because it is easier
to marshal to the child and because this should protect against races
where the directory might be renamed or removed between addfchdir and
the actual setting of the cwd in the child.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Wed, 28 May 2025 19:40:44 +0000 (12:40 -0700)]
Cygwin: allow redirecting stderr in ch_spawn
stdin and stdout were alreadly allowed for popen, but implementing
posix_spawn in terms of spawn would require stderr as well.
Replace the conveniently-located 4 filler bytes with int __stderr so
that child_info_spawn doesn't have to grow.
Introduce a struct for passing additional args to ch_worker.spawn, since
there are getting to be quite a lot of additional args.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Fri, 19 Sep 2025 20:36:30 +0000 (13:36 -0700)]
Cygwin: lock cygheap during fork
another thread may simultaneously be doing a cmalloc/cfree while the
cygheap is being copied to the child.
Addresses: https://cygwin.com/pipermail/cygwin/2025-September/258801.html
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Takashi Yano [Sat, 30 Aug 2025 03:08:21 +0000 (12:08 +0900)]
Cygwin: Note Ctrl-O (FLUSHO) fix to release note
Takashi Yano [Sat, 30 Aug 2025 02:39:39 +0000 (11:39 +0900)]
Cygwin: pty: Fix FLUSHO handling
Previsouly, FLUSHO did not work correctly.
1) Even when FLUSHO is set, read() returns with undesired data in
the pipe if select() is called in advance.
2) FLUSHO is toggled even in the case pseudo console enabled.
Due to these problems, read data in the pty master was partially
lost when Ctrl-O is pressed.
With this patch, the mask_flusho flag, that was introduced by the
commit
9677efcf005a and caused the issue 1), has been dropped and
select() and read() for pty master discards the pipe data instead
if FLUSHO flag is set. In addition, FLUSHO handling in the case
pseudo console activated is disabled.
Addresses: https://cygwin.com/pipermail/cygwin/2025-August/258717.html
Fixes:
2cab4d0bb4af ("Cygwin: pty, console: Refactor the code processing special keys.")
Fixes:
9677efcf005a ("Cygwin: pty: Make FLUSHO and Ctrl-O work.")
Reported-by: Reported-by: Thomas Wolff <towo@towo.net>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Andrew Stubbs [Wed, 27 Aug 2025 10:11:25 +0000 (10:11 +0000)]
amdgcn, libm: fix vector ilogb bugs (bug 33272)
The vector ilogb routines, including the ones inlined into fmod, had a bug
in which the conditional masks were not properly applied, causing the value of
one lane to be affected by conditional choices of another lane. The problem
was not immediately obviously because all values were calculated correctly when
no lane contained a subnormal input.
The problem is fixed by proper use of VECTOR_COND_MOVE and VECTOR_WHILE.
Jeremy Drake [Mon, 18 Aug 2025 22:59:54 +0000 (15:59 -0700)]
Cygwin: fix finding overlaps from F_SETLKW.
The commit adding OFD locks changed from comparing just the F_POSIX and
F_LOCK flags to comparing the entire flags value in order to make sure
the locks are of the same type. However, the F_WAIT flag may or may not
be set, and result in that comparison not matching. Mask the F_WAIT
flag when attempting to compare the types of the locks.
This fixes the "many_locks" stc.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Fixes:
a66ed519884d ("Cygwin: fcntl: implement Open File Description (OFD) locks")
Jeremy Drake [Mon, 18 Aug 2025 19:48:18 +0000 (12:48 -0700)]
Cygwin: fix fcntl F_GETLK
The commit implementing OFD locks dropped the F_GETLK case from the
switch in fhandler_base::lock, replacing it with F_OFD_GETLK. This
appears to have been an oversight, as F_OFD_SETLK was added as an
additional case above.
This resulted in the winsup.api/ltp/fcntl05 test failing.
Fixes:
a66ed519884d ("Cygwin: fcntl: implement Open File Description (OFD) locks")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Takashi Yano [Fri, 15 Aug 2025 20:57:06 +0000 (05:57 +0900)]
Cygwin: spawn: Make ch_spwan_local be initialized properly
The class child_info_spawn has two constructors: one without arguments
and one with two arguments. The former does not initialize any members.
Commit
1f836c5f7394 used the latter to ensure that the local ch_spawn
(i.e., ch_spawn_local) would be properly initialized. However, this was
insufficient - it initialized only the base child_info members, not the
fields specific to child_info_spawn. This led to the issue reported in
https://cygwin.com/pipermail/cygwin/2025-August/258660.html.
This patch introduces a new constructor to properly initialize member
variable 'ev', etc., which were referred without initialization, and
switches ch_spawn_local to use it. 'subproc_ready', which may not be
initialized, is also initialized in the constructor of the base class
child_info.
Addresses: https://cygwin.com/pipermail/cygwin/2025-August/258660.html
Fixes:
1f836c5f7394 ("Cygwin: spawn: Make system() thread-safe")
Reported-by: Denis Excoffier <cygwin@Denis-Excoffier.org>
Reviewed-by: Jeremy Drake <cygwin@jdrake.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Sebastian Huber [Tue, 20 May 2025 01:24:02 +0000 (03:24 +0200)]
rtems: No-return _arc4random_getentropy_fail()
The _arc4random_getentropy_fail() function does not return. Mark it as
such.
Andrew Stubbs [Thu, 7 Aug 2025 13:09:41 +0000 (13:09 +0000)]
amdgcn, libm: fix infinite loop
The end condition on this loop, unlike all the other similar loops, is
"i >= 0", which is a problem because "i <<= 1" can go negative and then zero if
you continue shifting, and so back to true, again. This isn't a problem for
the loop in the scalar implementation, but it means we need to mask the shift
in the vector implementation.
This fixes GCC PR#121392.
Jeff Johnston [Thu, 7 Aug 2025 18:09:16 +0000 (14:09 -0400)]
Regenerate libgloss configure
Mikael Hildenborg [Mon, 4 Aug 2025 19:50:29 +0000 (21:50 +0200)]
Added target m68k-atari-elf supporting Atari 16/32bit TOS systems.
Jeremy Drake [Tue, 5 Aug 2025 22:57:44 +0000 (15:57 -0700)]
Cygwin: add release note for new C++ wrappers.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Corinna Vinschen [Tue, 5 Aug 2025 15:08:01 +0000 (17:08 +0200)]
Cygwin: fcntl: implement Open File Description (OFD) locks
Partially quoting the LINUX man page:
Open file description locks are advisory byte-range locks whose opera‐
tion is in most respects identical to the traditional record locks de‐
scribed above.
The principal difference between the two lock types is that whereas tra‐
ditional record locks are associated with a process, open file descrip‐
tion locks are associated with the open file description on which they
are acquired, much like locks acquired with flock(2). Consequently (and
unlike traditional advisory record locks), open file description locks
are inherited across fork(2) (and clone(2) with CLONE_FILES), and are
only automatically released on the last close of the open file descrip‐
tion, instead of being released on any close of the file.
Conflicting lock combinations (i.e., a read lock and a write lock or two
write locks) where one lock is an open file description lock and the
other is a traditional record lock conflict even when they are acquired
by the same process on the same file descriptor.
Just like traditional advisory record locks, OFD locks do not conflict
with BSD file locks acquired with flock(2).
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Mon, 4 Aug 2025 18:16:20 +0000 (20:16 +0200)]
Cygwin: fcntl: define F_OFD flag
This will be used by a followup patch to denote OFD locks per POSIX.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Mon, 4 Aug 2025 18:15:24 +0000 (20:15 +0200)]
Cygwin: fcntl: move lock types definition to fcntl.h header
This is in preparation for implementing OFD locks per POSIX.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Mon, 4 Aug 2025 18:45:38 +0000 (20:45 +0200)]
Cygwin: file locking: always use and expect explicit lock variant
So far, not setting a lock variant (F_POSIX/F_FLOCK) defaulted to
F_POSIX locks. Adding OFD locks in a followup patch may lead to
confusion, so make sure that the lock variant is always set in the
calling functions (fcntl, flock, lockf). Bail out with EINVAL if
no lock variant is set.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Mon, 4 Aug 2025 13:12:38 +0000 (15:12 +0200)]
sys/_default_fcntl.h: Define OFD lock operations
Linux and POSIX-1.2024 define operations to create OFD (Open
File Description) locks.
OFD locks are like POSIX record locks, but bound to the file descriptor,
not bound to the process. As such, they are also inherited via fork(2)
and dup(2), just like BSD flock(2) locks.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Mon, 4 Aug 2025 13:02:52 +0000 (15:02 +0200)]
sys/_default_fcntl.h: fix whitespace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Jeremy Drake [Fri, 1 Aug 2025 18:03:00 +0000 (11:03 -0700)]
Cygwin: add api version check to c++ malloc struct override.
This prevents memory corruption if a newer app or dll is used with an
older cygwin dll. This is an unsupported scenario, but it's still a
good idea to avoid corrupting memory if possible.
Fixes:
7d5c55faa1 ("Cygwin: add wrappers for newer new/delete overloads")
Co-authored-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jean-Paul Mari [Fri, 27 Jun 2025 10:57:15 +0000 (06:57 -0400)]
Fix missing declarations in libgloss m68k
This patch adds missing function declarations in several m68k-specific
libgloss source files. This helps avoid implicit declaration compiler
warnings / errors and ensures better portability.
Tested by building newlib for m68k-elf with GCC.
Jeremy Drake [Thu, 31 Jul 2025 21:06:53 +0000 (14:06 -0700)]
Cygwin: bump API version for addition of new/delete wrappers
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Fri, 25 Jul 2025 20:05:30 +0000 (13:05 -0700)]
Cygwin: add wrappers for newer new/delete overloads
A sized delete (with a std::size_t parameter) was added in C++14 (but
doesn't combine with nothrow_t)
An aligned new/delete (with a std::align_val_t parameter) was added in
C++17, and combinations with the sized delete and nothrow_t variants.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Radek Bartoň [Sat, 19 Jul 2025 17:17:12 +0000 (19:17 +0200)]
Cygwin: mkimport: implement AArch64 +/-4GB relocations
Based on https://sourceware.org/pipermail/cygwin-patches/2025q3/014154.html
suggestion, this patch implements +/-4GB relocations for AArch64 in the mkimport
script by using adrp and ldr instructions. This change required update
in winsup/cygwin/mm/malloc_wrapper.cc where those instructions are
decoded to get target import address.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Radek Bartoň [Thu, 24 Jul 2025 10:36:02 +0000 (12:36 +0200)]
newlib: libc: return back support for AArch64 ILP32
This patch is returning back support for AArch64 ILP32 ABI that was
removed in
de479a54e22e8fcb6262639a8e67fe8b00a27c37 commit but is needed
to ensure source code compatibility with GCC 14.
The change in newlib/libc/machine/aarch64/asmdefs.h makes it
out-of-the-sync with the current upstream implementation in
https://github.com/ARM-software/optimized-routines repository.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Joel Sherrill [Fri, 25 Jul 2025 17:10:03 +0000 (12:10 -0500)]
Revert Joel's working ilp32 patch
This was what I was using locally before Radek Bartoň
<radek.barton@microsoft.com> had his version of the patch. Revert in
favor of his final version.
Revert
70c5505766ad4ae62e4d045835ed2a6b928d5760
Joel Sherrill [Mon, 21 Jul 2025 22:23:46 +0000 (17:23 -0500)]
ilp32: Revert patch removing ilp32 support
ilp32 support was removed prematurely. It is still in GCC 15 which is
the latest GCC release.
From: <radek.barton@microsoft.com>
Date: Thu, 5 Jun 2025 11:32:08 +0200
Subject: [PATCH] newlib: libc: update asmdefs.h compatible with Cygwin AArch64
This patch synchronizes newlib/libc/machine/aarch64/asmdefs.h header with
version from https://github.com/ARM-software/optimized-routines/commit/
4352245388a55a836f3ac9ac5907022c24ab8e4c
commit that added support for AArch64 Cygwin.
This version of the header removed PTR_ARG and SIZE_ARG macros as ILP32 was
deprecated which introduced changes in many .S files so the patch contains
removal of usages of those macros.
On top of that, setjmp.S and rawmemchr.S were refactored to use
ENTRY/ENTRY_ALIGN and END macros. `
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Takashi Yano [Thu, 24 Jul 2025 05:36:48 +0000 (14:36 +0900)]
Cygwin: Fix handling of archetype fhandler in process_fd
Previously, process_fd failed to correctly handle fhandlers using an
archetype. This was due to the missing PATH_OPEN flag in path_conv,
which caused build_fh_pc() to skip archetype initialization. The
root cause was a bug where open() did not set the PATH_OPEN flag
for fhandlers using an archetype.
This patch introduces a new method, path_conv::set_isopen(), to
explicitly set the PATH_OPEN flag in path_flags in fhandler_base::
open_with_arch().
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258167.html
Fixes:
92ddb7429065 ("(build_pc_pc): Use fh_alloc to create. Set name from fh->dev if appropriate. Generate an archetype or point to one here.")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Corinna Vinschen [Thu, 24 Jul 2025 09:24:32 +0000 (11:24 +0200)]
Cygwin: Add UTF-8 surrogate fix to release messages
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Wed, 23 Jul 2025 20:42:52 +0000 (22:42 +0200)]
Cygwin: _sys_wcstombs: add FIXME comment
Add a FIXME comment to the conversion of private use area bytes to
"normal" bytes in _sys_wcstombs detailing the conversion difference
between _sys_wcstombs and standard wcstombs. It might be a good idea
to drop the conversion to gather compatibility with wcstombs.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Wed, 23 Jul 2025 20:42:01 +0000 (22:42 +0200)]
Cygwin: _sys_mbstowcs: fix handling invalid 4-byte UTF-8 sequences
When a 4 byte utf-8 sequence has an invalid 4th byte, it's actually
an invalid 3 byte sequence. In this case we already generated the
high surrogate and only realize the problem when byte 4 doesn't
match.
At this point _sys_mbstowcs transposes the invalid 4th byte into the
private use area.
This is wrong. The invalid byte sequence here is the 3 byte sequence
already converted to a high surrogate, not the trailing 4th byte.
Fix this by backtracking to the start of the broken sequence and
overwrite the already written high surrogate with a sequence of
the original three bytes transposed to the private use area. Reset
the mbstate and restart normal conversion at the non-matching
4th byte, which might start a new multibyte sequence.
The resulting wide-char string can be converted back to multibyte
and back again to wide-char, and the result will be identical, even
if the multibyte sequence differs from the original sequence.
Fixes:
e44b9069cd227 ("* strfuncs.cc (sys_cp_mbstowcs): Treat src as unsigned char *. Convert failure of f_mbtowc into a single malformed utf-16 value.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Tue, 22 Jul 2025 12:54:47 +0000 (14:54 +0200)]
Revert "mbrtowc: fix handling invalid UTF-8 4 byte sequences if wchar_t == UTF-16"
This reverts commit
b374973d14ac7969b10ba719feedc709f6971c0d.
Turns out this patch breaks mbrtowc. Example:
--- SNIP ---
void mb(unsigned char c)
{
wchar_t wc;
int ret = mbrtowc(&wc, &c, 1, 0);
printf("%02X -> %04X : %d\n", c, wc, ret);
}
void main ()
{
setlocale (LC_CTYPE, "");
mb(0xF0);
mb(0x9F);
mb(0x98);
mb(0x8E);
}
--- SNAP ---
Output before commit
b374973d14ac:
F0 -> 0000 : -2
9F -> 0000 : -2
98 -> D83D : 1
8E -> DE0E : 1
Output after commit
b374973d14ac:
F0 -> 0000 : -2
9F -> 0000 : -2
98 -> 0000 : -2
8E -> D83D : 3
By using mbrtowc(), the high surrogate is only emitted after byte 4, and
there's no way to recover the low surrogate. The byte count is also incorrect.
Conclusion: We have to emit the high surrogate already after byte 3
to be able to emit the low surrogate after byte 4.
Reported-by: Thomas Wolff <towo@towo.net>
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258513.html
Fixes:
b374973d14ac ("mbrtowc: fix handling invalid UTF-8 4 byte sequences if wchar_t == UTF-16")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Takashi Yano [Wed, 23 Jul 2025 11:02:26 +0000 (20:02 +0900)]
Cygwin: Add recent fixes to release note 3.6.5
Takashi Yano [Sat, 19 Jul 2025 14:49:26 +0000 (23:49 +0900)]
Cygwin: spawn: Make system() thread-safe
POSIX states system() shall be thread-safe, however, it is not in
current cygwin. This is because ch_spawn is a global and is shared
between threads. With this patch, system() uses ch_spawn_local
instead which is local variable. popen() has the same problem, so
it has been fixed in the same way.
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258324.html
Fixes:
1fd5e000ace5 ("import winsup-2000-02-17 snapshot")
Reported-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Takashi Yano [Sat, 19 Jul 2025 14:39:12 +0000 (23:39 +0900)]
Cygwin: spawn: Lock cygheap from refresh_cygheap() until child_copy()
...completion in child process because the cygheap should not be
changed to avoid mismatch between child_info::cygheap_max and
::cygheap_max. Otherwise, child_copy() might copy cygheap being
modified by other process.
In addition, to avoid deadlock, move close_all_files() for non-
Cygwin processes after unlocking cygheap, since close_all_files()
calls cfree(), which attempts to lock cygheap even when it's already
locked.
Fixes:
977ad5434cc0 ("* spawn.cc (spawn_guts): Call refresh_cygheap before creating a new process to ensure that cygheap_max is up-to-date.")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Takashi Yano [Sat, 19 Jul 2025 14:39:12 +0000 (23:39 +0900)]
Cygwin: cygheap: Add lock()/unlock() method
...so that cygheap can be locked/unlocked from outside of mm/cygheap.cc.
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Paul Cercueil [Tue, 22 Jul 2025 21:45:40 +0000 (23:45 +0200)]
sys/cdefs.h: Protect parameters to __builtin_is_aligned()
The macro was not protecting properly its first parameter, which caused
it to silently return an invalid value when passing a composed
parameter, ie.
__builtin_is_aligned(src | dst | len, 32);
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Corinna Vinschen [Wed, 23 Jul 2025 09:11:01 +0000 (11:11 +0200)]
Reapply "libc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IO"
This reverts commit
bb2c338520b9da9fd3ac067438e9aeeffc0b122a.
Accidental push.
Hau Hsu [Tue, 22 Jul 2025 10:31:20 +0000 (12:31 +0200)]
Revert "libc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IO"
This reverts commit
3b97a5ec67a5a52c130158bb143949cd842de305.
Christian Franke [Wed, 16 Jul 2025 09:33:25 +0000 (11:33 +0200)]
Cygwin: doc: add note about raw devices of BitLocker partitions
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Radek Bartoň [Sat, 21 Jun 2025 20:56:58 +0000 (22:56 +0200)]
Cygwin: configure: add possibility to skip build of cygserver and utils
This patch adds configure options allowing to disable build of cygserver
and Cygwin utilities. This is useful when one needs to build only
cygwin1.dll and crt0.o with stage1 compiler that is not yet capable of
linking executables as it is missing cygwin1.dll and crt0.o.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Radek Bartoň [Thu, 3 Jul 2025 10:02:03 +0000 (12:02 +0200)]
newlib: add dummy implementations of fe{get,set}prec for Aarch64 Cygwin
This patch introduces dummy implementation of fegetprec and fsetprec for Cygwin
build as those symbols are being exported by cygwin1.dll and AArch64 do not support
changing floating point precision at runtime.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Corinna Vinschen [Fri, 18 Jul 2025 12:06:16 +0000 (14:06 +0200)]
Cygwin: clocks: read leap secs from /etc/leapsecs on older systems
Systems prior to W10 1803 don't have the leapsecs registry key
HKLM\SYSTEM\CurrentControlSet\Control\LeapSecondInformation and
don't handle leap seconds at all.
Given that new leap seconds are a rather seldom, irregular event,
drop reading from /usr/share/zoneinfo/leapseconds. Just read the
same leap second records from a file /etc/leapsecs as stored in
the LeapSeconds registry value on newer systems instead.
As a sidenote, the code reading from /usr/share/zoneinfo/leapseconds
was wrong anyway, because it didn't take the timestamps into account.
Given IERS publishes new leap seconds about 6 months before they
occur, CLOCK_TAI would have been one second off for up to 6 months.
/etc/leapsecs doesn't exist yet, so we just default to 37 secs. If
new leap seconds get provided for newer systems, make sure to provide
the /etc/leapsecs file as part of the Cygwin distro with identical
entries.
Fixes:
2abb929f0ad2 ("Cygwin: clocks: Implement CLOCK_TAI")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Fri, 18 Jul 2025 08:15:30 +0000 (10:15 +0200)]
Cygwin: sys/termios.h: define struct winsize before using it
Long-standing bug in the sys/termios.h file which, for some reason,
has never been encountered before.
STC:
#include <sys/termios.h>
int main()
{
struct winsize win;
tcgetwinsize (0, &win);
}
Result with gcc 12.4.0:
termios-bug.c: In function ‘main’:
termios-bug.c:7:20: warning: passing argument 2 of ‘tcgetwinsize’ from incompatible pointer type [-Wincompatible-pointer-types]
7 | tcgetwinsize (0, &win);
| ^~~~
| |
| struct winsize *
In file included from termios-bug.c:1:
/usr/include/sys/termios.h:304:42: note: expected ‘struct winsize *’ but argument is of type ‘struct winsize *’
304 | int tcgetwinsize(int fd, struct winsize *winsz);
| ~~~~~~~~~~~~~~~~^~~~~
This warning apparently becomes an error with C23.
The reason is that struct winsize is defined in sys/termios.h after
using it as argument type in function declarations. From the compil;er
perspective it's now a different type , regardless of having the same
name.
Move declaration of struct winsize up so it's defined before being used.
Reported-by: Zachary Santer <zsanter@gmail.com>
Suggested-by: Zachary Santer <zsanter@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258474.html
Fixes:
1fd5e000ace55 ("import winsup-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Joel Sherrill [Wed, 16 Jul 2025 19:07:47 +0000 (14:07 -0500)]
libc/include/sys/stat.h: Adjust for RTEMS MIPS
The commit cited below introduced changes which included
conditionals strictly on __mips__. This ignored tailoring
for any environment on MIPS except that targeted by the
author of the change. This patch just fixes this code for
RTEMS.
commit
467a2bdf17ad376dafada9f1734784f4611fa6fd
Author: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Date: Wed Jun 11 10:11:33 2025 +0200
mips: Implement MIPS HAL and UHI
Implement abstract interface for MIPS, including unified hosting
interface (UHI).
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Arijit Kumar Das [Thu, 17 Jul 2025 10:51:16 +0000 (16:21 +0530)]
nvptx: Change 'read' and 'write' to 'ssize_t' return type
This commit changes the return type of the read() and write() syscalls for
nvptx to ssize_t. This would allow large files to be handled properly by
these syscalls in situations where the read/write buffer length exceeds
INT_MAX, for example. This also makes the syscall signatures fully complaint
with their current POSIX specifications.
We additionally define two macros: '_READ_WRITE_RETURN_TYPE' as _ssize_t and
'_READ_WRITE_BUFSIZE_TYPE' as __size_t in libc/include/sys/config.h under
__nvptx__ for consistency.
Signed-off-by: Arijit Kumar Das <arijitkdgit.official@gmail.com>
Corinna Vinschen [Thu, 17 Jul 2025 12:22:28 +0000 (14:22 +0200)]
Cygwin: clocks: read leap seconds from registry
Windows 10 1803 introduced leap seconds support in 2018. The OS always
starts at 37 leap secs. Additional leap second timestamps are added to
the registry key HKLM\SYSTEM\CurrentControlSet\Control\LeapSecondInformation,
value LeapSeconds.
If the key exists, read the leap second timestamps from this value,
otherwise fallback to reading /usr/share/zoneinfo/leapseconds.
Note that we might change the file we read from yet, but that's no part
of this patch.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Thu, 17 Jul 2025 11:36:42 +0000 (13:36 +0200)]
Cygwin: reg_key: add a method get_binary() to fetch REG_BINARY data
This patch is required for a followup patch fetching the leap seconds
info from the registry starting with Windows 10 1803.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Radek Bartoň [Mon, 9 Jun 2025 11:08:35 +0000 (13:08 +0200)]
Cygwin: cygcheck: port to AArch64
This patch ports `winsup/utils/mingw/cygcheck.cc` to AArch64:
- Adds arch=aarch64 to packages API URL.
- Ports dll_info function.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Radek Bartoň [Thu, 5 Jun 2025 09:32:08 +0000 (11:32 +0200)]
newlib: libc: update asmdefs.h compatible with Cygwin AArch64
This patch synchronizes newlib/libc/machine/aarch64/asmdefs.h header with
version from https://github.com/ARM-software/optimized-routines/commit/
4352245388a55a836f3ac9ac5907022c24ab8e4c
commit that added support for AArch64 Cygwin.
This version of the header removed PTR_ARG and SIZE_ARG macros as ILP32 was
deprecated which introduced changes in many .S files so the patch contains
removal of usages of those macros.
On top of that, setjmp.S and rawmemchr.S were refactored to use
ENTRY/ENTRY_ALIGN and END macros. `
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Jeremy Drake [Wed, 9 Jul 2025 18:06:20 +0000 (11:06 -0700)]
Cygwin: testsuite: link cygload with --disable-high-entropy-va
This is a mingw program meant to demonstrate loading the Cygwin dll in a
non-Cygwin process, but the Cygwin dll still initializes the cygheap on
load in that case. Without --disable-high-entropy-va, Windows may
occasionally locate the PEB, TEB, and/or stacks in the address space
that Cygwin tries to reserve for the cygheap, resulting in a failure.
Fixes:
60675f1a7eb2 ("Cygwin: decouple shared mem regions from Cygwin DLL")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Corinna Vinschen [Wed, 16 Jul 2025 14:26:42 +0000 (16:26 +0200)]
Cygwin: clocks: Implement CLOCK_TAI
CLOCK_TAI is like CLOCK_REALTIME ignoring leap secs. Right now,
2025, it has a positive 37 secs offset from CLOCK_REALTIME.
Given the unpredictability of adding leap secs by the IERS
(International Earth Rotation and Reference Systems Service),
we also add a mechanism to read the current leap secs offset from
/usr/share/zoneinfo/leapseconds, part of the tzdata package.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Takashi Yano [Wed, 16 Jul 2025 14:21:17 +0000 (23:21 +0900)]
newlib: fclose: Use sfp lock while fp lock is active
With the commit
656df313e08a, if a thread acquires sfp lock after
another thread calls fclose() and fp lock is acquired, the first
thread falls into deadlock if it tries to acquire fp lock. This can
happen if the first thread calls __sfp_lock_all() while the second
thread calls fclose().
This patch reverts the changes for newlib/libc/stdio/fclose.c in
the commit
656df313e08a.
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258323.html
Fixes:
656df313e08a ("* libc/stdio/fclose.c: Only use sfp lock to guard non-atomic changes of flags and fp lock.")
Reported-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Jon Turney [Tue, 15 Jul 2025 20:13:48 +0000 (21:13 +0100)]
Cygwin: CI: deploy full set of documentation files from install directory
Deploy (what is now a full set of) documentation files from install
directory.
Sebastian Huber [Wed, 16 Jul 2025 10:09:10 +0000 (12:09 +0200)]
libc/time: Add CLOCK_TAI
For _GNU_VISIBLE, provide the CLOCK_TAI clock identifier for the
International Atomic Time. Use the value specified by glibc and Linux.
Add _BSD_VISIBLE given FreeBSD also provides this clock identifier.
Corinna Vinschen [Wed, 16 Jul 2025 10:12:05 +0000 (12:12 +0200)]
Cygwin: add clock bugfixes to 3.6.5 release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Wed, 16 Jul 2025 09:46:02 +0000 (11:46 +0200)]
Cygwin: POSIX timer: handle TIMER_ABSTIME correctly for all realtime clocks
Add CLOCK_REALTIME_COARSE and CLOCK_REALTIME_ALARM to the clocks
allowing an absolute timeout value to be used as such in NtSetTimer.
Fixes:
c05df02725c59 ("Cygwin: implement extensible clock interface")
Fixes:
013e2bd9ecf85 ("Cygwin: posix timers: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Corinna Vinschen [Wed, 16 Jul 2025 09:26:15 +0000 (11:26 +0200)]
Cygwin: clocks: use InterlockedCompareExchange64
The clock init functions checked timer ticks/period for 0 and then
called InterlockedExchange64 if the value was still 0. This is not
quite as atomic as it was supposed to be.
Use InterlockedCompareExchange64 instead.
Fixes:
2b72887ac834b ("Cygwin: clocks: fix a hang on pre-Windows 10 machines")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Jon Turney [Wed, 25 Jun 2025 16:57:03 +0000 (17:57 +0100)]
Cygwin: doc: Install miscellaneous website files
This gives us a full set of the built documentation files in the install
directory, which can then be appropriately filtered for packaging or
deploying to website, as required.
Again, there will be a separate change to the cygwin packaging to avoid
including theses files in the cygwin-doc package.
Also, add matching uninstall rules.
Jon Turney [Tue, 27 May 2025 16:13:37 +0000 (17:13 +0100)]
Cygwin: doc: Install FAQ as well
We don't currrently deploy the CSS file to the website, because the FAQ
doesn't get installed, so instead we copy all the doc files from the
build directory.
That omits docbook.css, which is installed from directly from the source
directory. (We just happen to have a similar file lying around on the
webserver).
Instead, just install the FAQ.
There will be a separate change to the cygwin packaging to avoid
including the FAQ in the cygwin-doc package. (I guess we'd rather people
go online for that, to ensure they have the latest version?)
Also, add matching uninstall rules.
Radek Bartoň [Fri, 6 Jun 2025 12:31:30 +0000 (14:31 +0200)]
Cygwin: gendef: stub implementations of routines for AArch64
This patch aspires to provide only minimal changes to
`winsup/cygwin/scripts/gendef` allowing to pass the AArch64 build. It does not
provide any implementations of the generated routines.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Christian Franke [Mon, 14 Jul 2025 12:44:01 +0000 (14:44 +0200)]
Cygwin: doc: warn about unprivileged access to raw devices
Raw devices of partitions may be accessible from unprivileged
processes, for example if connected via USB.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Radek Bartoň [Wed, 4 Jun 2025 12:55:34 +0000 (14:55 +0200)]
Cygwin: signal: make context structures registers handling portable
This patch extracts macros from winsup/cygwin/exceptions.cc serving for portable
register access to context structures into a separate local header
winsup/cygwin/local_includes/register.h and implements their AArch64
counterparts.
Then, it adds AArch64 declaration of __mcontext structure based on
mingw-w64-headers/include/winnt.h header to
winsup/cygwin/include/cygwin/singal.h header.
Then, it includes the registers.h header and uses the macros where applicable,
namely at:
- winsup/cygwin/exceptions.cc
- winsup/cygwin/profil.c
- winsup/cygwin/tread.cc
The motivation is to make usage of the context structures portable without
unnecessary #if defined(__x86_64__) while implementations of signal handling
code will be developed later, e.g. implementation of makecontext.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Evgeny Karpov [Fri, 4 Jul 2025 18:20:37 +0000 (20:20 +0200)]
Cygwin: malloc_wrapper: port to AArch64
Implements import_address function by decoding adr AArch64 instructions to get target address.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Radek Bartoň [Thu, 3 Jul 2025 10:00:52 +0000 (12:00 +0200)]
Cygwin: add dummy implementation of _fe_nomask_env
_fe_nomask_env is exported by cygwin.din but not used at all for AArch64.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Radek Bartoň [Wed, 11 Jun 2025 21:07:21 +0000 (23:07 +0200)]
Cygwin: dumper: port to AArch64
This patch allows to build winsup/utils/dumper.cc for AArch64 by handling target
architecture condition in dumper::init_core_dump.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Radek Bartoň [Tue, 10 Jun 2025 15:11:20 +0000 (17:11 +0200)]
Cygwin: profiler: port to AArch64
This patch allows to build winsup/utils/profiler.cc for AArch64 by handling
target architecture condition in find_text_section function implementation.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Corinna Vinschen [Mon, 14 Jul 2025 11:44:17 +0000 (13:44 +0200)]
Cygwin:testsuite: winchild: drop unused variable
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Radek Bartoň [Mon, 9 Jun 2025 06:45:27 +0000 (08:45 +0200)]
Cygwin: mkimport: port to support AArch64
This patch ports winsup/cygwin/scripts/mkimport script to AArch64, namely
implements relocation to the imp_sym.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Takashi Yano [Mon, 14 Jul 2025 01:40:08 +0000 (10:40 +0900)]
Cygwin: pty: TCIFLUSH also clears readahead buffer in the master
Previously, TCIFLUSH flushed the pipe to_slave which transfers
input from master to slave. However, this was not sufficiant.
The master side holds input data before accept_input() in the
read-ahead buffer. So, if input data before 'enter' key can be
leaked into slave input after TCIFLUSH.
With this patch, TCIFLUSH requests master to flush read-ahead
buffer via master control pipe. To realize this, add cmd filed
to pipe_request structure so that the flush request can be
distinguished from existing pipe handle request.
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258442.html
Fixes:
41946df6111b (" (fhandler_tty_slave::tcflush): Implement input queue flushing by calling read with NULL buffer.")
Reported-by: Christoph Reiter <reiter.christoph@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Radek Bartoň [Tue, 1 Jul 2025 15:49:55 +0000 (17:49 +0200)]
Cygwin: winchild: fix missing stdlib.h
The posix_spawn/winchild test was added recently by
2af1914b6ad673a2041cf94cc8e78e1bdec57a27 commit. It fails to build for AArch64
due to missing stdlib.h header where malloc and free functions are defined.
This patch fixes the missing header.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
m fally [Tue, 17 Jun 2025 15:07:35 +0000 (17:07 +0200)]
newlib: Regenerate configuration files
Regenerate the configuration files since a file was replaced
in the RISC-V port, and one other file was renamed.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
m fally [Tue, 17 Jun 2025 15:07:34 +0000 (17:07 +0200)]
RISC-V: memmove() speed optimized: Call memcpy()
Redirect to memcpy() if the memory areas of source and destination
do not overlap. Only redirect if length is > SZREG in order to
reduce overhead on very short copies.
Signed-off-by: m fally <marlene.fally@gmail.com>
m fally [Tue, 17 Jun 2025 15:07:33 +0000 (17:07 +0200)]
RISC-V: memmove() speed optimized: Align source address
If misaligned accesses are slow or prohibited, either
source or destination address are unaligned and the number
of bytes to be copied is > SZREG*2, align the source address
to xlen. This speeds up the function in the case where at
least one address is unaligned, since now one word (or doubleword
for rv64) is loaded at a time, therefore reducing the amount of
memory accesses necessary.
We still need to store back individual bytes since the
destination address might (still) be unaligned after aligning
the source.
The threshold of SZREG*2 was chosen to keep the negative effect
on shorter copies caused by the additional overhead from aligning
the source low.
This change also affects the case where both adresses are xlen-
aligned, the memory areas overlap destructively, and length is not
a multiple of SZREG. In the destructive-overlap case, the copying
needs to be done in reversed order. Therefore the length is added
to the addresses first, which causes them to become unaligned.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
m fally [Tue, 17 Jun 2025 15:07:32 +0000 (17:07 +0200)]
RISC-V: memmove() speed optimized: Add loop-unrolling
Add loop-unrolling for the case where both source and destination
address are aligned in the case of a destructive overlap, and
increase the unroll factor from 4 to 9 for the word-by-word
copy loop in the non-destructive case.
This matches the loop-unrolling done in memcpy() and increases
performance for lenghts >= SZREG*9 while almost not at all
degrading performance for shorter lengths.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
m fally [Tue, 17 Jun 2025 15:07:31 +0000 (17:07 +0200)]
RISC-V: memmove() speed optimized: Replace macros and use fixed-width types
Replace macros with static inline functions or RISC-V specifc
macros in order to keep consistency between all functions in the port.
Change data types to fixed-width and/or RISC-V specific types.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
m fally [Tue, 17 Jun 2025 15:07:30 +0000 (17:07 +0200)]
RISC-V: memmove() speed optimized: Add implementation
Copy the common implementation of memmove() to the RISC-V port.
Rename memmove.S to memmove-asm.S to keep naming of files
consistent between functions. Update Makefile.inc with the changed
filenames.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
Jeremy Drake [Tue, 8 Jul 2025 21:40:11 +0000 (14:40 -0700)]
Cygwin: testsuite: test posix_spawn_file_actions_addopen with O_CLOEXEC
This was previously not handled correctly by newlib.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Jeremy Drake [Tue, 8 Jul 2025 21:22:45 +0000 (14:22 -0700)]
posix_spawn: preserve FD flags when processing FAE_OPEN
According to the POSIX documentation, "when the new process image is
executed, any file descriptor (from this new set) which has its
FD_CLOEXEC flag set shall be closed (see posix_spawn())." The "new set"
is after processing the file actions, so if addopen had the O_CLOEXEC
flag set the descriptor should be closed after the exec.
The adddup2 docs, by contrast, specify that the flag should be cleared,
even if dup2 wouldn't have done so due to the specified file descriptors
being equal. Add a comment to that effect.
Addresses: https://sourceware.org/pipermail/newlib/2025/021968.html
Fixes:
c7c1a1ca1b ("2013-10-01 Petr Hosek <phosek@chromium.org>")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Christian Franke [Wed, 9 Jul 2025 13:04:50 +0000 (15:04 +0200)]
Cygwin: CI: cygstress: remove 'filerace', 'flock' and 'fork' from CI
The 'filerace' test may run longer than the watchdog timeout.
'flock' and 'fork' may leave processes behind for some unknown reason.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Corinna Vinschen [Tue, 8 Jul 2025 19:54:19 +0000 (21:54 +0200)]
Cygwin: open: only fix file attributes when trying to create file
Only try to fix the cached DOS attributes if the caller actually
tried to create the file. Otherwise the fixup code is called even
in cases where we open the file with minimal query access bits and
NtQueryInformationFile() could fail with STATUS_ACCESS_DENIED and
the new cached DOS attributes are wrong again.
Fixes:
37c49decc835f ("Cygwin: open: only fix up cached DOS file attributes for on-disk files")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Jeremy Drake [Mon, 7 Jul 2025 18:26:37 +0000 (11:26 -0700)]
Cygwin: spawn: apply PID_NEW_PG flag to spawned child
Previously, it was always applied to "myself", which is only appropriate
in the case of _P_OVERLAY (aka exec). Apply the flag to "myself" only
in that case, and apply it to the new child instead in other cases.
Also, clear the flag from "myself" in the case of a failed exec.
Fixes:
8d8724ee1b5a ("Cygwin: pty: Fix Ctrl-C handling further for non-cygwin apps.")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Radek Bartoň [Fri, 6 Jun 2025 12:13:16 +0000 (14:13 +0200)]
Cygwin: define OUTPUT_FORMAT and SEARCH_DIR for AArch64
This patch defines binutils output binary format for AArch64 which is pei-aarch64-little.
Since =/usr/lib/w32api resolves to $SYSROOT/usr/lib/w32api and Fedora cross-build takes libraries from
/usr/aarch64-pc-cygwin/sys-root/usr/lib/w32api, the SEARCH_DIR("/usr/x86_64-pc-cygwin/lib/w32api"); is
redundant and can be removed.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
Christian Franke [Sat, 5 Jul 2025 17:10:21 +0000 (19:10 +0200)]
Cygwin: CI: cygstress: add ability to run all tests multiple times
Add options '-e' and '-r' to control error behavior and number of
test runs.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Christian Franke [Sat, 5 Jul 2025 17:06:30 +0000 (19:06 +0200)]
Cygwin: CI: cygstress: update for stress-ng 0.19.02 and current Cygwin
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Faraz Shahbazker [Wed, 25 Sep 2019 04:59:46 +0000 (21:59 -0700)]
libc: mips: fix strcmp bug for little endian targets
strcmp gives incorrect result for little endian targets under
the following conditions:
1. Length of 1st string is 1 less than a multiple of 4 (i.e len%4=3)
2. First string is a prefix of the second string
3. The first differing character in the second string is extended
ASCII (that is > 127)
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Faraz Shahbazker [Mon, 29 Jul 2019 22:23:16 +0000 (15:23 -0700)]
libgloss: mips: UHI linker scripts fail to link with _isr_vec_count=1
This _isr_vec_count=1 is prevalent in MIPS Open FGPA examples.
Looks like forcing _isr_vec_007 in to the link was a mistake
and we always intended to only include the top-level _isr_vec
symbol.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Faraz Shahbazker [Wed, 21 Nov 2018 18:33:47 +0000 (10:33 -0800)]
libgloss: mips: g++ exception handling failure on o32 elf targets
The compiler driver positions the linker script at the end of the linker
command-line, after crtend.o. As a result, any INPUT objects and archive
GROUPs introduced by the linker script end up after crtend.o. This messes up
the end-of-frame marker provided by crtend.o
This has always been a problem, but a recent binutils update to clean-up
redundant NULL markers in .eh_frame exposes it as a execution failure in
exception-handling tests. This patch re-orders .eh_frame in all linker
scripts so that the one from crtend.o is placed last.
An alternative approach would be to fix the compiler driver to put
the linker script before the ENDFILE spec.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Faraz Shahbazker [Tue, 28 Aug 2018 22:21:08 +0000 (15:21 -0700)]
libc: mips: Improve performance of strcmp implementation
Improve `strcmp` by using `ext` instruction, if available.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Faraz Shahbazker [Fri, 16 Nov 2018 22:38:16 +0000 (14:38 -0800)]
libc: mips: memcpy prefetches beyond copied memory
Fix prefetching in core loop to avoid exceeding the operated upon
memory region. Revert accidentally changed prefetch-hint back to
streaming mode. Refactor various bits and provide pre-processor
checks to allow parameters to be overridden from compiler command
line.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Faraz Shahbazker [Mon, 13 Aug 2018 15:24:14 +0000 (08:24 -0700)]
libc: mips: Add improved C implementation of memcpy/memset
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Matthew Fortune [Sat, 20 Jan 2018 21:08:20 +0000 (21:08 +0000)]
libgloss: mips: Fixes and improvements for CM3 bootcode
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Robert Suchanek [Mon, 14 Aug 2017 07:41:42 +0000 (08:41 +0100)]
libgloss: mips: Boot and startup code improvements inc. linker script fixes
Add .eh_frame_hdr and .gnu_extab to linker scripts for compactEH
Fix orphaned .gcc_except_table sections in uhi32.ld.
Fix orphaned .gcc_except_table sections in mti32.ld.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Matthew Fortune [Sat, 17 Feb 2018 19:05:23 +0000 (19:05 +0000)]
libgloss: mips: Add srec2hex.pl for preparing input to simulators
srec2hex.pl is a PERL script file which converts S-record file
to a MIPS HEX file, which can be useful for some simulation
environments.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Jovan Dmitrović [Tue, 4 Feb 2025 14:16:46 +0000 (15:16 +0100)]
libgloss: mips: Add mipshal.mk
Make using MIPS HAL component easier by including `mipshal.mk`
into source Makefile.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
This page took 0.099585 seconds and 5 git commands to generate.