aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
2022-11-12makedocbook: Use sys.exit()Jon Turney1-10/+6
Use sys.exit() to write a message to stderr and terminate with a non-zero exit code.
2022-11-12makedocbook: Use raw strings for regexesJon Turney1-11/+11
Use raw strings for regexes. This is best practice, and fixes a number of "W605 invalid escape sequence" flakes.
2022-11-10powerpc/setjmp: Fix 64-bit buffer alignmentSebastian Huber1-0/+16
The rlwinm is a word-size instruction which clears the remaining 32 bits of a 64-bit register. Use clrrdi in 64-bit configurations.
2022-11-08Generally make all 'long double complex' methods available in <complex.h>Thomas Schwinge1-19/+16
..., not just '#if defined(__CYGWIN__)'. (Exception: 'clog10l' which currently indeed is for Cygwin only.) This completes 2017-07-05 commit be3ca3947402827aa52709e677369bc7ad30aa1d "Fixed warnings for some long double complex methods" after Aditya Upadhyay's work on importing "Long double complex methods" from NetBSD. For example, this changes GCC/nvptx libgfortran 'configure' output as follows: [...] checking for ccosf... yes checking for ccos... yes checking for ccosl... [-no-]{+yes+} [...] ..., and correspondingly GCC/nvptx 'nvptx-none/libgfortran/config.h' as follows: [...] /* Define to 1 if you have the `ccosl' function. */ -/* #undef HAVE_CCOSL */ +#define HAVE_CCOSL 1 [...] Similarly for 'ccoshl', 'cexpl', 'cpowl', 'csinl', 'csinhl', 'ctanl', 'ctanhl', 'cacoshl', 'cacosl', 'casinhl', 'catanhl'. ('conjl', 'cprojl' are not currently being used in libgfortran.) This in turn simplifies GCC/nvptx 'libgfortran/intrinsics/c99_functions.c' compilation such that this files doesn't have to provide its own "Implementation of various C99 functions" for those, when in fact they're available in newlib libm.
2022-10-29strftime/wcsftime: use STRLEN, not strlenCorinna Vinschen1-1/+1
Commit 737e2004a3bb accidentally introduced a call to strlen in code used with wide character strings in case of wcsftime. Use STRLEN instead. Fixes: 737e2004a3bb ("strftime.c(__strftime): add %q, %v, tests; tweak %Z doc") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-29makedocbook: Add explicit locking for PLY parser table generationJon Turney3-229/+227
Drop 'makedocbook --cache' (any dependency on the man-cache rule which invokes that was dropped by the non-recursive make changes) Instead, add some explicit locking which prevents processes colliding over the file containing generated python code for the parser table.
2022-10-28powerpc/setjmp: Fix 64-bit supportSebastian Huber1-57/+72
The first attempt to support the 64-bit mode had two bugs: 1. The saved general-purpose register 31 value was overwritten with the saved link register value. 2. The link register was saved and restored using 32-bit instructions. Use 64-bit store/load instructions to save/restore the link register. Make sure that the general-purpose register 31 and the link register storage areas do not overlap.
2022-10-28Fix warning during manpage generatonJon Turney1-2/+12
> ERROR: xref linking to Stubs has no generated link text. > Error: no ID for constraint linkend: Stubs. (Despite saying "ERROR", this is actually a warning, and manpages are still generated) Improve chapter-texi2docbook so it generates elements for texinfo sections as well, so that a cross-reference to the "Stubs" section contains a valid element ID.
2022-10-25strftime.c(__strftime): add %q, %v, tests; tweak %Z docBrian Inglis1-3/+55
%q GNU quarter year 1-4 %v BSD/OSX/Ruby VMS/Oracle %e-%b-%Y %Z change time zone *name* to *abbreviation*
2022-10-24strptime.c(strptime_l): add %q GNU quarterBrian Inglis1-1/+9
2022-09-28Rerun automake in newlib/Szabolcs Nagy1-2/+20
newlib/libc/sys/arm/Makefile.inc was modified but automake was not rerun in commit 5230eb7f8c6b43c71d7e38d138935c48de930b76 Implement sysconf for Arm on arm-none-eabi target this caused ld: B/arm-none-eabi/lib/libg.a(libc_a-mallocr.o): in function `malloc_extend_top': S/newlib-cygwin/newlib/libc/stdlib/_mallocr.c:2161: undefined reference to `sysconf'
2022-09-26Fix missing extern C statementMarkus B. Moessner1-0/+7
2022-09-24powerpc/setjmp: Add 64-bit supportSebastian Huber2-9/+78
Use 64-bit store/load instructions to save/restore the general-purpose registers.
2022-09-19Implement sysconf for ArmJeff Johnston4-1/+39
- add support for using sysconf to get page size in _mallocr.c via HAVE_SYSCONF_PAGESIZE flag set in configure.host - set flag in configure.host for arm and add a default sysconf implementation in libc/sys/arm that returns the page size - the default implementation can be overridden outside newlib to allow a different page size to improve malloc on devices with a small footprint without needing to rebuild newlib - this patch is based on a contribution from Torbjorn Svensson and Niklas Dahlquist (https://ecos.sourceware.org/ml/newlib/current/017616.html)
2022-09-10upstream OpenBSD: arc4random: fix indenttb1-2/+2
2022-09-10upstream OpenBSD: arc4random: Randomise the rekey interval a little.djm1-3/+14
Previously, the chacha20 instance would be rekeyed every 1.6MB. This makes it happen at a random point somewhere in the 1-2MB range. Feedback deraadt@ visa@, ok tb@ visa@ newlib port: Make REKEY_BASE depend on SIZE_MAX Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-09-10upstream OpenBSD: arc4random: Remove unused ivbits argument from chacha_keysetupdtucker2-4/+4
to match other instances in the tree. ok deraadt@
2022-09-10upstream OpenBSD: arc4random: replace abort() with _exit()deraadt1-2/+2
In the incredibly unbelievable circumstance where _rs_init() fails to allocate pages, don't call abort() because of corefile data leakage concerns, but simply _exit(). The reasoning is _rs_init() will only fail if someone finds a way to apply specific pressure against this failure point, for the purpose of leaking information into a core which they can read. We don't need a corefile in this instance to debug that. So take this "lever" away from whoever in the future wants to do that.
2022-09-10upstream OpenBSD: arc4random: bump file versionsCorinna Vinschen2-2/+2
This hides a patch not required in newlib
2022-09-10upstream OpenBSD: arc4random: Add support for building arc4random with MSVC.bcook1-7/+8
By default, MSVC's stdlib.h defines min(), so we need to spell out something less common to avoid picking it up. ok deraadt@ beck@ miod@
2022-09-01Don't allocate another header when merging chunksTorbjörn SVENSSON1-4/+0
In the nano version of malloc, when the last chunk is to be extended, there is no need to acount for the header again as it's already taken into account in the overall "alloc_size" at the beginning of the function. Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-09-01Used chunk needs to be removed from free_listTorbjörn SVENSSON1-0/+9
When using nano malloc and the remaning heap space is not big enough to fullfill the allocation, malloc will attempt to merge the last chunk in the free list with a new allocation in order to create a bigger chunk. This is successful, but the chunk still remains in the free_list, so any later call to malloc can give out the same region without it first being freed. Possible sequence to verify: void *p1 = malloc(3000); void *p2 = malloc(4000); void *p3 = malloc(5000); void *p4 = malloc(6000); void *p5 = malloc(7000); free(p2); free(p4); void *p6 = malloc(35000); free(p6); void *p7 = malloc(42000); void *p8 = malloc(32000); Without the change, p7 and p8 points to the same address. Requirement, after malloc(35000), there is less than 42000 bytes available on the heap. Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-08-31Fix some Coverity Scan errors.Jeff Johnston6-2/+10
2022-08-31Restore _lock initialization in non-single threaded modeTorbjörn SVENSSON1-0/+4
When __SINGLE_THREAD__ is not defined, stdin, stdout and stderr needs to have their _lock instance initialized. The __sfp() method is not invoked for the 3 mentioned fds thus, the std() method needs to handle the initialization of the lock. This is more or less a revert of 382550072b49430f8c69adee937a0ba07bd385e6 Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-08-22Fix problem with _newlib_version.h not being filled in correctlyJeff Johnston3-11/+22
2022-08-15SH: Do not build syscalls if option providedYilin Sun via Newlib2-6/+8
This patch makes syscalls for SH architecture respecting the global option "--disable-newlib-supplied-syscalls". This is useful when a bare-metal toolchain is needed. Signed-off-by: Yilin Sun <imi415@imi.moe>
2022-08-12newlocale: fix crash when trying to write to __C_localeCorinna Vinschen1-1/+2
This simple testcase: locale_t st = newlocale(LC_ALL_MASK, "C", (locale_t)0); locale_t st2 = newlocale(LC_CTYPE_MASK, "en_US.UTF-8", st); is sufficient to reproduce a crash in _newlocale_r. After the first call to newlocale, `st' points to __C_locale, which is const. When using `st' as locale base in the second call, _newlocale_r tries to set pointers inside base to NULL. This is bad if base is __C_locale, obviously. Add a test to avoid trying to overwrite pointer values inside base if base is __C_locale. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03Cygwin: drop requirement to build newlib's stdio64Corinna Vinschen2-5/+0
Given that 64 bit Cygwin defines all file access types (off_t, fpos_t, and derived types) as 64 bit anyway, there's no reason left to rely on the stdio64 part of newlib. Use base functions and base types. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-07-13Add --enable-newlib-reent-thread-local optionMatt Joyce33-0/+267
By default, Newlib uses a huge object of type struct _reent to store thread-specific data. This object is returned by __getreent() if the __DYNAMIC_REENT__ Newlib configuration option is defined. The reentrancy structure contains for example errno and the standard input, output, and error file streams. This means that if an application only uses errno it has a dependency on the file stream support even if it does not use it. This is an issue for lower end targets and applications which need to qualify the software according to safety standards (for example ECSS-E-ST-40C, ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333). If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct _reent is replaced by dedicated thread-local objects for each struct _reent member. The thread-local objects are defined in translation units which use the corresponding object.
2022-07-13Add _REENT_IS_NULL()Matt Joyce4-3/+13
In a follow up patch, struct _reent is optionally replaced by dedicated thread-local objects. In this case,_REENT is optionally defined to NULL. Add the _REENT_IS_NULL() macro to disable this check on demand.
2022-07-13Add _REENT_SIG_FUNC(ptr)Matt Joyce3-15/+16
Add a _REENT_SIG_FUNC() macro to encapsulate access to the _sig_func member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_CVTBUF(ptr)Matt Joyce3-8/+9
Add a _REENT_CVTBUF() macro to encapsulate access to the _cvtbuf member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_CVTLEN(ptr)Matt Joyce2-4/+5
Add a _REENT_CVTLEN() macro to encapsulate access to the _cvtlen member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow-up patch.
2022-07-13Add _REENT_CLEANUP(ptr)Matt Joyce8-9/+10
Add a _REENT_CLEANUP() macro to encapsulate access to the __cleanup member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_LOCALE(ptr)Matt Joyce3-4/+5
Add a _REENT_LOCALE() macro to encapsulate access to the _locale member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_INC(ptr)Matt Joyce2-3/+4
Add a _REENT_INC() macro to encapsulate access to the _inc member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_STDERR(ptr)Matt Joyce4-6/+7
Add a _REENT_STDERR() macro to encapsulate access to the _stderr member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_STDOUT(ptr)Matt Joyce5-8/+9
Add a _REENT_STDOUT() macro to encapsulate access to the _stdout member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_STDIN(ptr)Matt Joyce5-8/+9
Add a _REENT_STDIN() macro to encapsulate access to the _stdin member of struct reent. This will help to replace the struct member with a thread-local storage object in a follow up patch.
2022-07-13Add _REENT_ERRNO(ptr)Matt Joyce104-251/+252
Add a _REENT_ERRNO() macro to encapsulate the access to the _errno member of struct reent. This will help to replace the structure member with a thread-local storage object in a follow up patch. Replace uses of __errno_r() with _REENT_ERRNO(). Keep __errno_r() macro for potential users outside of Newlib.
2022-07-13Define _REENT_EMERGENCY(ptr) only onceMatt Joyce2-4/+4
Use this macro to access the _emergency member of struct _reent. This macro will help to replace the _emergency member of struct _reent with a thread-local storage object in a follow up patch.
2022-07-13Move content in <sys/reent.h>Sebastian Huber1-12/+12
Move definitions not directly related to struct _reent to the bottom of the file. This allows a contiguous #ifndef _REENT_THREAD_LOCAL_STORAGE block.
2022-07-11RTEMS: Add READMESebastian Huber1-0/+79
2022-07-11libc/syslog: fully deprecate and don't try to open "/dev/log"Gleb Smirnoff1-1/+0
The "/dev/log" socket existed in pre-FreeBSD times. Later it was substituted to a compatibility symlink. The symlink creation was deprecated in FreeBSD 10.2 and 9-STABLE. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35304
2022-07-11arp: Implement sticky ARP mode for interfaces.Konrad Sewiłło-Jopek1-0/+1
Provide sticky ARP flag for network interface which marks it as the "sticky" one similarly to what we have for bridges. Once interface is marked sticky, any address resolved using the ARP will be saved as a static one in the ARP table. Such functionality may be used to prevent ARP spoofing or to decrease latencies in Ethernet networks. The drawbacks include potential limitations in usage of ARP-based load-balancers and high-availability solutions such as carp(4). The implemented option is disabled by default, therefore should not impact the default behaviour of the networking stack. Sponsored by: Conclusive Engineering sp. z o.o. Reviewed By: melifaro, pauamma_gundo.com Differential Revision: https://reviews.freebsd.org/D35314 MFC after: 2 weeks
2022-07-11Correctly measure system load averages > 1024Alan Somers1-4/+4
The old fixed-point arithmetic used for calculating load averages had an overflow at 1024. So on systems with extremely high load, the observed load average would actually fall back to 0 and shoot up again, creating a kind of sawtooth graph. Fix this by using 64-bit math internally, while still reporting the load average to userspace as a 32-bit number. Sponsored by: Axcient Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D35134
2022-07-11Add ifcap2 names for RXTLS4 and RXTLS6 interface capabilitiesKonstantin Belousov1-0/+6
and corresponding nvlist capabilities name strings. Reviewed by: hselasky, jhb, kp (previous version) Sponsored by: NVIDIA Networking MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D32551
2022-07-11Kernel-side infrastructure to implement nvlist-based set/get ifcapsKonstantin Belousov2-2/+49
Reviewed by: hselasky, jhb, kp (previous version) Sponsored by: NVIDIA Networking MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D32551
2022-07-11tcp: LRO code to deal with all 12 TCP header flagsRichard Scheffenegger1-2/+2
TCP per RFC793 has 4 reserved flag bits for future use. One of those bits may be used for Accurate ECN. This patch is to include these bits in the LRO code to ease the extensibility if/when these bits are used. Reviewed By: hselasky, rrs, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D34127
2022-07-11kernel: deprecate Internet Class A/B/CMike Karels1-5/+17
Hide historical Class A/B/C macros unless IN_HISTORICAL_NETS is defined; define it for user level. Define IN_MULTICAST separately from IN_CLASSD, and use it in pf instead of IN_CLASSD. Stop using class for setting default masks when not specified; instead, define new default mask (24 bits). Warn when an Internet address is set without a mask. MFC after: 1 month Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D32708