aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
31 hoursMake sure mallinfo structure matches newlib's malloc.hHEADgithub/mastergithub/mainmastermainJeff Johnston1-10/+10
2024-09-02Replace __restrict with __restrict_arr in regex.hyang.zhang1-1/+1
when a C++ source file include this header file, it would build fail. Signed-off-by: yang.zhang <zhangyang01@kylinos.cn>
2024-09-02newlib: esp: add dirent.h header fileAlexey Lapshin4-8/+63
Support dirent in *-esp-* toolchains
2024-09-02newlib: xtensa: remove sys/xtensa. use machine/xtensaAlexey Lapshin15-115/+13
Remove sys/xtensa that is actually duplicate newlib's code. Move used code to machine/xtensa or to libgloss
2024-09-02Cygwin: pipe: Fix a regression that raw_write() slows downTakashi Yano2-2/+7
After the commit 7f3c22532577, writing to pipe extremely slows down. This is because cygwait(select_sem, 10, cw_cancel) is called even when write operation is already completed. With this patch, the cygwait() is called only if the write operation is not completed. Addresses: https://cygwin.com/pipermail/cygwin/2024-August/256398.html Fixes: 7f3c22532577 ("Cygwin: pipe: handle signals explicitely in raw_write") Reported-by: Jim Reisert AD1C <jjreisert@alum.mit.edu> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-08-31Cygwin: console: Disable cons_master_thread in win32-input-modeTakashi Yano3-2/+14
When win32-input-mode (which is supported by Windows Termainal) is set by "\033[?9001h", cons_master_thread does not work properly and consumes larger and larger memory space. This is because sending event by WriteConsoleInput() is translated into the sequence that is used by win32-input-mode. Due to this behaviour, write-back of the INPUT_RECORDs does not work as expected. With this patch, cons_master_thread is disabled on win32-input-mode where the signal keys such as Ctrl-C, Ctrl-Z etc. never comes. Addresses: https://cygwin.com/pipermail/cygwin/2024-August/256380.html Fixes: ff4440fcf768 ("Cygwin: console: Introduce new thread which handles input signal.") Reported-by: Adamyg Mob <adamyg.mob@gmail.com> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-08-22Cygwin: add release message for latest pipe changesCorinna Vinschen1-0/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-22Cygwin: Add locale patches to release messageCorinna Vinschen1-0/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-22locales: Fix definition of lc_messages_T::codesetCorinna Vinschen1-1/+3
nl_langinfo_l accesses lc_messages_T::codeset as soon as __HAVE_LOCALE_INFO__ is defined, but codeset only exists if __HAVE_LOCALE_INFO_EXTENDED__ is defined. Fix this by defining lc_messages_T::codeset depending on __HAVE_LOCALE_INFO__. Fixes: ac7f1d5e931c ("Get rid of LCID, reformat type definitions in setlocale.h") Reported-by: Inglis <Brian.Inglis@SystematicSW.ab.ca> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-22nl_langinfo_l: drop erroneus messages::codeset entryCorinna Vinschen1-1/+0
The nl_ext array contains offsets into the extended info of locale structures, the index being equivalent to the nl_item values in langinfo.h. For the lc_messages_T struct, nl_ext erroneusly contains an entry for the codeset member, which is in fact not part of the extended info in nl_item. However, due to that, the offsets for subsequent entries are off by one. Fix this by dropping the messages::codeset entry from nl_ext. Fixes: d47d5b850bed ("Extend locale support to maintain wide char values of native strings") Reported-by: Brian Inglis <Brian.Inglis@systematicsw.ab.ca> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-21arc64: Add port for Synopsys DesignWare ARCv3 ISAYuriy Kolerov33-528/+4639
Synopsys ARCv3 ISA includes 32-bit ARC HS5x targets and 64-bit ARC HS6x targets. Both CPU families are placed in "arc64" subdirectories as it done for GCC port. Target name arc64 is used for historical reasons and Synopsys ARCv3 baremetal toolchains contain multilib configurations both for 32-bit and 64-bit families. arc32 target name is reserved for 32-bit ARC HS5x targets in case of non-multilib 32-bit builds. Note that libgloss libraries for ARCv3 are compatible with libgloss for ARCv1/2. Thus, Makefile.inc for libgloss uses sources from libgloss/arc directory except crtX.S files. Co-authored-by: Shahab Vahedi <list@vahedi.org> Co-authored-by: Claudiu Zissulescu <claziss@gmail.com> Co-authored-by: Bruno Mauricio <brunoasmauricio@gmail.com> Co-authored-by: Luis Silva <luis.m.silva99@hotmail.com> Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-21Update config.sub to GCC master branch versionYuriy Kolerov1-28/+53
New config.sub contains support of Synopsys ARCv3 targets. It's necessary for further porting Newlib for ARCv3. config.guess has not been updated yet in GCC. Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-21Use ldflags instead of LDFLAGS in newlib.expClaudiu Zissulescu1-2/+2
This variable was accidentally renamed earlier. It must be ldflags according to DejaGNU documentation. Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-08-20Add new version of Synopsys license.Jeff Johnston1-0/+14
2024-08-20arc: libgloss: Prepare for porting to ARCv3Yuriy Kolerov4-0/+38
There are 3 families of Synopsys DeisgnWare ARC processors: ARCompact/ARCv1 (32-bit), ARCv2 (32-bit) and ARCv3 (32-bit and 64-bit targets). Upstream Newlib supports only ARCv1/2. This commit prepares ARCv1/2 libgloss port to be reused by ARCv3 port (except crt* files). Note that __ARC64__ macro stands for all ARCv3 targets. Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-20arc: libgloss: Use exit code in _exit_halt for nSIMYuriy Kolerov1-2/+2
nSIM simulator supports exit codes. However, it's necessary to pass an exit code to _exit_halt, otherwise it's undefined. Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-20arc: libgloss: Accommodate MetaWare's standard symbol namesAlexey Brodkin8-25/+105
It makes it usable with standard symbol names defined in default linker scripts of the MetaWare toolchain. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2024-08-20arc: Remove @ from symbol references in assemblyAlexey Brodkin4-42/+42
There's no semantic change, it's only to make the same code compilable with MetaWare toolchian, which actually assumes @x as a full name, not omitting @. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2024-08-20arc: Use __ARC_UNALIGNED__ compiler macroClaudiu Zissulescu1-1/+17
Replace __ARC_ALIGNED_ACCESS__ macro with the compiler defined macro __ARC_UNALIGNED__ and improve file comments. Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-08-20arc: libgloss: Clean MetaWare hostlink documentationYuriy Kolerov1-67/+67
Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-20arc: libgloss: Switch from .balign to .alignAlexey Brodkin1-1/+1
.align is supported by both GCC & MetaWare compiler for ARC, yet implements the same semantics as .balign which only works with GCC. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2024-08-20arc: libgloss: Fix define guard in nsim-syscall.hYuriy Kolerov1-3/+3
Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-20Fix glob() functionJordi Sanfeliu2-5/+9
Fixed glob() function to return GLOB_NOMATCH if pattern does not match any existing pathname (and GLOB_NOCHECK was not set in flags).
2024-08-19newlib/libc/include/sys/tree.h: Add deprecation warningJoel Sherrill1-0/+4
2024-08-19libc/include/sys/tree.h: Re-add sys/tree.hJoel Sherrill1-0/+864
Reverts 1339af44679aee0895fe311cfad89d38cfc2b919
2024-08-19Cygwin: pipe: do short writes only once in nonblocking case tooCorinna Vinschen1-2/+1
If a nonblocking write requires short writes, just try it once as in the blocking case. After all, we are nonblocking, so don't loop unnecessarily. Fixes: 170e6badb621 ("Cygwin: pipe: improve writing when pipe buffer is almost full") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-19Cygwin: pipe: fix comparisonCorinna Vinschen1-1/+1
There's no reason to overwrite len1 with align if they are the same value. Fixes: 170e6badb621 ("Cygwin: pipe: improve writing when pipe buffer is almost full") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-18Cygwin: pipe: improve writing when pipe buffer is almost fullCorinna Vinschen3-18/+75
So far fhandler_pipe_fifo::raw_write always returns -1/EINTR if a signal arrived. Linux does not do that if there's still space left in the pipe buffer. The Linux buffer handling can't be emulated by Cygwin, but we can do something similar which makes it much more likely to still write successfully even if the buffer is almost full. Utilize pipe_data_available to return valid pipe buffer usage to raw_write, allowing a more sophisticated way to fill the buffer while maintaining comaptibility with non-Cygwin pipes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-18Cygwin: select: set pipe writable only if PIPE_BUF bytes leftCorinna Vinschen1-9/+9
Linux select(2) returns the pipe as writable if at least one free page (4K onl most systems) is left in a page-oriented buffer handling. This is the same as PIPE_BUF. Emulate this behaviour by only returning the pipe as writable if at least 4K space is left in the buffer. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-18Cygwin: pipe: handle signals explicitely in raw_writeCorinna Vinschen1-3/+12
The simple cygwait call in fhandler_pipe_fifo::raw_write doesn't take the SA_RESTART setting into account. Move handling the signal into raw_write. Fixes: 4b25687ea3ee2 ("Cygwin: fhandler_pipe: add raw_read and raw_write") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15stdlib.h: define __itoa/__utoa while building newlibCorinna Vinschen1-1/+1
This avoids a `__utoa undefined' warning when building newlib for Cygwin. We still need to export the symbols for backward compatibility. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15Cygwin: getopt.h: fix a commentCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15Fix POSIX guards for POSIX.1-2024 extensionsCorinna Vinschen3-7/+7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15features.h: support POSIX.1-2024Corinna Vinschen1-3/+15
TBD: Align _GNU_SOURCE, too? Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15features.h: fix whitespaceCorinna Vinschen1-44/+44
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-13Cygwin: Avoid use-after-free warnings in __set_lc_time_from_win() etc.Jon Turney1-54/+41
Rewrite to avoid new use-after-free warnings about realloc(), seen with gcc 12, e.g.: > In function ‘void rebase_locale_buf(const void*, const void*, const char*, const char*, const char*)’, > inlined from ‘int __set_lc_time_from_win(const char*, const lc_time_T*, lc_time_T*, char**, wctomb_p, const char*)’ at ../../../../src/winsup/cygwin/nlsfuncs.cc:705:25: > ../../../../src/winsup/cygwin/nlsfuncs.cc:338:24: error: pointer ‘new_lc_time_buf’ may be used after ‘void* realloc(void*, size_t)’ [-Werror=use-after-free] > 338 | *ptrs += newbase - oldbase; > | ~~~~~~~~^~~~~~~~~ > ../../../../src/winsup/cygwin/nlsfuncs.cc: In function ‘int __set_lc_time_from_win(const char*, const lc_time_T*, lc_time_T*, char**, wctomb_p, const char*)’: > ../../../../src/winsup/cygwin/nlsfuncs.cc:699:44: note: call to ‘void* realloc(void*, size_t)’ here > 699 | char *tmp = (char *) realloc (new_lc_time_buf, len); Technically, it's UB to later refer to the realloced pointer (even just for offset computations, without deferencing it), so switch to using malloc() to create the resized copy. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-08-13Cygwin: Fix warnings about narrowing conversions of socket ioctlsJon Turney2-2/+2
Fix gcc 12 warnings about narrowing conversions of socket ioctl constants when used as case labels, e.g: > ../../../../src/winsup/cygwin/net.cc: In function ‘int get_ifconf(ifconf*, int)’: > ../../../../src/winsup/cygwin/net.cc:1940:18: error: narrowing conversion of ‘2152756069’ from ‘long int’ to ‘int’ [-Wnarrowing] Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-08-07Cygwin: asm/socket.h: drop outdated castsCorinna Vinschen1-2/+2
The _IOR anbd _IOW macros cast the sizeof of their third arg uselessly to long. The _IO definitions have been taken from BSD in 1995 and never changed again. The fact that the sizeof() gets cast to long is probably a remnant from the past when the stuff was supposed to be used on 16 bit machines, but the value was supposed to be 32 bit. Given that the values are not supposed to be ever bigger than 32 bit, we drop the (long) cast. Compare with current FreeBSD, which does not cast at all. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-06Cygwin: Fix warning about narrowing conversions in tape optionsJon Turney2-3/+3
Fix a gcc 12 warning about a narrowing conversion in case labels for tape options. > In file included from /wip/cygwin/src/winsup/cygwin/include/sys/mtio.h:14, > from ../../../../src/winsup/cygwin/fhandler/tape.cc:13: > ../../../../src/winsup/cygwin/fhandler/tape.cc: In member function ‘int mtinfo_drive::set_options(HANDLE, int32_t)’: > ../../../../src/winsup/cygwin/fhandler/tape.cc:965:12: error: narrowing conversion of ‘4026531840’ from ‘unsigned int’ to ‘int’ [-Wnarrowing] Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-08-06Cygwin: Fix warning about address known to be non-NULL in /proc/localesJon Turney1-2/+1
Fix a gcc 12 warning about an address known to be non-NULL in format_proc_locale_proc(). > ../../../../src/winsup/cygwin/fhandler/proc.cc: In function ‘BOOL format_proc_locale_proc(LPWSTR, DWORD, LPARAM)’: > ../../../../src/winsup/cygwin/fhandler/proc.cc:2156:11: error: the address of ‘iso15924’ will never be NULL [-Werror=address] > 2156 | if (iso15924) > | ^~~~~~~~ > ../../../../src/winsup/cygwin/fhandler/proc.cc:2133:11: note: ‘iso15924’ declared here > 2133 | wchar_t iso15924[ENCODING_LEN + 1] = { 0 }; > | ^~~~~~~~ Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales") Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-08-06Cygwin: Fix warnings about narrowing conversions of NTSTATUS constantsJon Turney4-4/+4
Fix warnings with gcc 12 about narrowing conversions of NTSTATUS constants when used as case labels, e.g: > ../../../../src/winsup/cygwin/exceptions.cc: In static member function ‘static int exception::handle(EXCEPTION_RECORD*, void*, CONTEXT*, PDISPATCHER_CONTEXT)’: > ../../../../src/winsup/cygwin/exceptions.cc:670:10: error: narrowing conversion of ‘-1073741682’ from ‘NTSTATUS’ {aka ‘int’} to ‘unsigned int’ [-Wnarrowing] See also: c5bdf60ac46401a51a7e974333d9622966e22d67 Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-08-06Cygwin: Suppress array-bounds warning from NtCurrentTeb()Jon Turney1-0/+3
This disables a warning seen with gcc 12 caused by intrinsics used by the inline implementation of NtCurrentTeb() inside w32api headers. > In function ‘long long unsigned int __readgsqword(unsigned int)’, > inlined from ‘_TEB* NtCurrentTeb()’ at /usr/include/w32api/winnt.h:10020:86, > [...] > /usr/include/w32api/psdk_inc/intrin-impl.h:838:1: error: array subscript 0 is outside array bounds of ‘long long unsigned int [0]’ [-Werror=array-bounds] See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523#c6 Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-07-30stdatomic: make atomics compatible with GCC-14Alexey Lapshin1-1/+2
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631525.html brings c_atomic and cxx_atomic definitions into GCC. This patch makes atomics type detection correct for GCC. https://github.com/freebsd/freebsd-src/commit/680f40f38343de118d5b973129683804e496faaf
2024-07-19Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags resyncBrian Inglis1-17/+18
Linux 6.10 changed the content of cpufeatures.h to require explicit quoted flag names for output in comments, instead of requiring a null quoted string "" at the start of comments to suppress flag name output. As a result, some flags (not all for output) were renamed and others moved: - change dts to ds; move intel_ppin down; swap ibpd and ibrs; - change some flag names and descriptions that are not output. Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
2024-07-19Cygwin: fhandler/proc.cc(format_proc_cpuinfo): add newlinesBrian Inglis1-3/+4
Linux cpuinfo follows output for each processor with a blank line, so we output newlines to get a blank line: - newline after power management feature flags if printed; - newline to give blank line after each processor output. Reported-by: Achim Gratz https://cygwin.com/pipermail/cygwin/2024-July/256223.html Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
2024-07-19Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags addedBrian Inglis1-0/+8
0x8000000a EDX 18 x2avic virtual x2apic 0x80000022 EAX 2 amd_lbr_pmc_freeze AMD last br rec and perf mon ctrs freeze Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
2024-07-16newlib: Add more FreeBSD files for non LDBL_EQ_DBL supportKito Cheng11-12/+710
For RISC-V, AArch64, i386, and x86_64 - k_tanl.c is required for tanl; the linker will report `__kernel_tanl` not found when tanl is called. - s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are already available for ld80 but not for ld128.
2024-07-09sys/tree.h: RemovedJoel Sherrill1-864/+0
This file was from a specific older FreeBSD version. There have been multiple changes to this file with FreeBSD 14 including breaking changes to the file. Including this file as part of newlib results in not always having the correct version of sys/tree.h for any specific software. RTEMS will manage its use of this file outside of newlib.
2024-07-09libc/arm: add missing .cfi_sectionsClément Chigot7-0/+7
The modifications added by the series "M-profile PACBTI-enablement" (see 9d6b00511e50a54d2472d11f75f7c0f2b4a98b24) have introduced a couple of .cfi_* instructions. Like for e6459123e497409a9e3d845c39829a9602ba55a4, these instructions create object files which contain .eh_frame sections. However, ARM uses its own unwind info format, not .eh_frame, which is generated by ARM-specific directives, not .cfi_*. The .eh_frame sections are useless, but also not removed by strip and may be harmful with some linker scripts. Adding ".cfi_sections .debug_frame" (as in glibc) moves the generated directives towards .debug_frame instead of .eh_frame. Making them easier to handle. * libc/machine/arm/aeabi_memmove-thumb2.S: Use .cfi_sections .debug_frame. * libc/machine/arm/aeabi_memset-thumb2.S: Likewise. * libc/machine/arm/memchr.S: Likewise. * libc/machine/arm/memcpy-armv7m.S: Likewise. * libc/machine/arm/setjmp.S: Likewise. * libc/machine/arm/strlen-armv7.S: Likewise. * libc/machine/arm/strlen-thumb2-Os.S: Likewise.
2024-07-09libc/include/sys/resource.h: Add RUSAGE_THREADJoel Sherrill1-0/+3