aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-07-17newlib: fclose: Use sfp lock while fp lock is activeTakashi Yano1-1/+2
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>
2025-07-16Cygwin: CI: deploy full set of documentation files from install directoryJon Turney1-2/+2
Deploy (what is now a full set of) documentation files from install directory.
2025-07-16libc/time: Add CLOCK_TAISebastian Huber1-0/+6
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.
2025-07-16Cygwin: add clock bugfixes to 3.6.5 release messageCorinna Vinschen1-0/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-16Cygwin: POSIX timer: handle TIMER_ABSTIME correctly for all realtime clocksCorinna Vinschen1-1/+3
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>
2025-07-16Cygwin: clocks: use InterlockedCompareExchange64Corinna Vinschen1-6/+3
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>
2025-07-15Cygwin: doc: Install miscellaneous website filesJon Turney1-3/+7
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.
2025-07-15Cygwin: doc: Install FAQ as wellJon Turney1-1/+8
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.
2025-07-14Cygwin: gendef: stub implementations of routines for AArch64Radek Bartoň1-1/+41
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>
2025-07-14Cygwin: doc: warn about unprivileged access to raw devicesChristian Franke1-1/+9
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>
2025-07-14Cygwin: signal: make context structures registers handling portableRadek Bartoň6-35/+135
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>
2025-07-14Cygwin: malloc_wrapper: port to AArch64Evgeny Karpov1-0/+14
Implements import_address function by decoding adr AArch64 instructions to get target address. Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-14Cygwin: add dummy implementation of _fe_nomask_envRadek Bartoň1-0/+10
_fe_nomask_env is exported by cygwin.din but not used at all for AArch64. Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-14Cygwin: dumper: port to AArch64Radek Bartoň1-1/+3
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>
2025-07-14Cygwin: profiler: port to AArch64Radek Bartoň1-1/+3
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>
2025-07-14Cygwin:testsuite: winchild: drop unused variableCorinna Vinschen1-1/+0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-14Cygwin: mkimport: port to support AArch64Radek Bartoň1-0/+11
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>
2025-07-14Cygwin: pty: TCIFLUSH also clears readahead buffer in the masterTakashi Yano3-5/+30
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>
2025-07-11Cygwin: winchild: fix missing stdlib.hRadek Bartoň1-1/+1
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>
2025-07-10newlib: Regenerate configuration filesm fally1-26/+26
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>
2025-07-10RISC-V: memmove() speed optimized: Call memcpy()m fally1-67/+93
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>
2025-07-10RISC-V: memmove() speed optimized: Align source addressm fally1-50/+135
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>
2025-07-10RISC-V: memmove() speed optimized: Add loop-unrollingm fally1-9/+48
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>
2025-07-10RISC-V: memmove() speed optimized: Replace macros and use fixed-width typesm fally1-25/+35
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>
2025-07-10RISC-V: memmove() speed optimized: Add implementationm fally4-15/+100
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>
2025-07-09Cygwin: testsuite: test posix_spawn_file_actions_addopen with O_CLOEXECJeremy Drake1-0/+10
This was previously not handled correctly by newlib. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-07-09posix_spawn: preserve FD flags when processing FAE_OPENJeremy Drake1-3/+11
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>
2025-07-09Cygwin: CI: cygstress: remove 'filerace', 'flock' and 'fork' from CIChristian Franke1-3/+4
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>
2025-07-08Cygwin: open: only fix file attributes when trying to create fileCorinna Vinschen2-2/+5
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>
2025-07-07Cygwin: spawn: apply PID_NEW_PG flag to spawned childJeremy Drake1-6/+11
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>
2025-07-07Cygwin: define OUTPUT_FORMAT and SEARCH_DIR for AArch64Radek Bartoň1-1/+3
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>
2025-07-05Cygwin: CI: cygstress: add ability to run all tests multiple timesChristian Franke1-28/+135
Add options '-e' and '-r' to control error behavior and number of test runs. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-07-05Cygwin: CI: cygstress: update for stress-ng 0.19.02 and current CygwinChristian Franke1-29/+35
Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-07-04libc: mips: fix strcmp bug for little endian targetsFaraz Shahbazker1-2/+5
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>
2025-07-04libgloss: mips: UHI linker scripts fail to link with _isr_vec_count=1Faraz Shahbazker3-6/+6
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>
2025-07-04libgloss: mips: g++ exception handling failure on o32 elf targetsFaraz Shahbazker3-3/+22
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>
2025-07-04libc: mips: Improve performance of strcmp implementationFaraz Shahbazker1-79/+123
Improve `strcmp` by using `ext` instruction, if available. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libc: mips: memcpy prefetches beyond copied memoryFaraz Shahbazker1-53/+97
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>
2025-07-04libc: mips: Add improved C implementation of memcpy/memsetFaraz Shahbazker4-5/+586
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: Fixes and improvements for CM3 bootcodeMatthew Fortune4-33/+27
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: Boot and startup code improvements inc. linker script fixesRobert Suchanek7-47/+144
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>
2025-07-04libgloss: mips: Add srec2hex.pl for preparing input to simulatorsMatthew Fortune3-0/+205
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>
2025-07-04libgloss: mips: Add mipshal.mkJovan Dmitrović2-0/+148
Make using MIPS HAL component easier by including `mipshal.mk` into source Makefile. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04mips: Implement MIPS HAL and UHIJovan Dmitrović120-535/+15841
Implement abstract interface for MIPS, including unified hosting interface (UHI). Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04aarch64: Export fe{enable,disable,get}except on CygwinRadek Bartoň1-4/+12
For aarch64 on ELF targets, the library does not export fe{enable,disable,get}except as symbols from the library, relying on static inline functions to provide suitable definitions if required. But for Cygwin we need to create real definitions to satisfy the DLL export script. So arrange for real definitions of these functions when building on Cygwin. Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-03Cygwin: gentls_offsets: port to support AArch64Radek Bartoň1-2/+2
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-03Cygwin: GetArm64ProcAddress: drop unsupported __i386__ code branchCorinna Vinschen1-4/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-03Cygwin: add fastcwd to AArch64 buildRadek Bartoň1-0/+5
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-03Cygwin: format_process_maps: avoid crashing PID when fetching heap infoCorinna Vinschen2-3/+34
To fetch heap info for a process in our /proc/PID/maps emulation, we call RtlQueryProcessDebugInformation on this process since commit b4966f91396b ("(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation"). However, it turns out that this call can crash the targeted process, if it's called from multiple threads or processes in parallel. Worse, the entire code from creating the debug buffer, over fetching the debug info, subsequent collecting the information from said debug buffer, up to destroying the buffer, needs to be guarded against parallel access. We do this by adding a global mutex object, serializing access to the debug info of a process. Reported-by: Christian Franke <Christian.Franke@t-online.de> Fixes: b4966f91396b ("(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-03Cygwin: dlsym: fetch module list via EnumProcessModulesCorinna Vinschen2-24/+13
We're using RtlQueryProcessDebugInformation from dlsym since commit 31ddf45dd8694 ("* autoload.cc (EnumProcessModules): Remove.") Observations on the Cygwin mailing list show that calling RtlQueryProcessDebugInformation on a process is neither thread-safe, nor multi-process-safe, see https://cygwin.com/pipermail/cygwin/2025-July/258403.html for details. This patch essentially reverts 31ddf45dd8694. Fetch the list of loaded modules in the current process by calling EnumProcessModules again. Reported-by: Christian Franke <Christian.Franke@t-online.de> Fixes: 31ddf45dd8694 ("* autoload.cc (EnumProcessModules): Remove.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>