aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
2019-07-24hash functions: use reentrant stat functionsCorinna Vinschen1-6/+6
_stat64 and _fstat64 are not exported from Cygwin. Use the reentrant analogues, like everywhere else. Signed-off-by: Corinna Vinschen <corinna-cygwin@cygwin.com>
2019-07-24Regenerate newlib/libc/search/Makefile.in for ndpm portCorinna Vinschen1-20/+42
Signed-off-by: Corinna Vinschen <corinna-cygwin@cygwin.com>
2019-07-24fix compile errors for efgcvt.cuchan-nos1-15/+18
2019-07-24Port ndbmVaibhav Gupta3-0/+311
2019-07-23Stack Pointer and Stack Limit initialization refactored.Alexander Fedotov2-89/+227
SP initialization changes: 1. set default value in semihosting case as well 2. moved existing SP & SL init code for processor modes in separate routine and made it as "hook" 3. init SP for processor modes in Thumb mode as well Add new macro FN_RETURN, FN_EH_START and FN_EH_END.
2019-07-09Set errno in expm1{,f} / log1p{,f}Jeff Johnston4-6/+14
2019-07-09 Joern Rennecke <joern.rennecke@riscy-ip.com> * libm/common/s_expm1.c ("math_config.h"): Include. (expm1): Use __math_oflow to set errno. * libm/common/s_log1p.c ("math_config.h"): Include. (log1p): Use __math_divzero and __math_invalid to set errno. * libm/common/sf_expm1.c ("math_config.h"): Include. (expm1f): Use __math_oflow to set errno. * libm/common/sf_log1p.c ("math_config.h"): Include. (log1pf): Use __math_divzero and __math_invalid to set errno.
2019-06-27sched: Move Cygwin cpuset definitions into Cygwin-specific headerCorinna Vinschen1-18/+0
This avoids build breakage on RTEMS. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-06-27or1k: Avoid write outside setjmp buf & shrink bufMartin Erik Werner2-29/+32
Update the offsets used to save registers into the stejmp jmp_buf structure in order to: * Avoid writing the supervision register outside the buffer and thus clobbering something on the stack. Previously the supervision register was written at offset 124 while the buffer was of length 124. * Shrink the jmp_buf down to the size actually needed, by avoiding holes at the locations of omitted registers.
2019-06-27or1k: Correct longjmp return valueMartin Erik Werner1-1/+1
Invert equality check instruction to correct the return value handling in longjmp. The return value should be the value of the second argument to longjmp, unless the argument value was 0 in which case it should be 1. Previously, longjmp would set return value 1 if the second argument was non-zero, and 0 if it was 0, which was incorrect.
2019-06-25Support calculation of pointer size for __int20__ type in _intsup.hJozef Lawrynowicz1-0/+4
GCC r272640 modifies the MSP430 target to use "__int20__" for PTRDIFF_TYPE (and therefore INTPTR_TYPE) instead of "__int20". To support the calculation of pointer size in newlib/libc/include/sys/_intsup.h, definitions for __int20__ need to be added.
2019-06-24Cygwin: Implement sched_[gs]etaffinity()Mark Geisert1-0/+23
This patch set implements the Linux syscalls sched_getaffinity, sched_setaffinity, pthread_getaffinity_np, and pthread_setaffinity_np. Linux has a straightforward view of the cpu sets used in affinity masks. They are simply long (1024-bit) bit masks. This code emulates that view while internally dealing with Windows' distribution of available CPUs among processor groups.
2019-06-14Rename <xlocale.h> back to <sys/_locale.h>Corinna Vinschen11-13/+13
libX11 provides <X11/Xlocale.h>. The build of libX11 itself adds include/X11 to the compiler's include path. This results in a name collision with /usr/include/xlocale.h on case-insensitive filesystems. Commit 90e35b1eb3df renamed sys/_locale.h to xlocale.h in March 2017 under the assumption that we should provide the locale_t type in the same file as on Linux, FreeBSD, and Darwin. A few weeks later (June 2017), glibc removed the xlocale.h file in favor of bits/types/locale_t.h, which shouldn't be included directly anyway. For reference and the reasoning, see https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336d Given the above, revert 90e35b1eb3df4070e68afc5e7060665214d586be and fix additional usage of xlocale.h.
2019-06-07Fix __getreent stack calculations for AMD GCNJeff Johnston1-6/+6
From: Andrew Stubbs <ams@codesourcery.com> Fix a bug in which the high-part of 64-bit values are being corrupted, leading to erroneous stack overflow errors. The problem was only that the mixed-size calculations are being treated as signed when they should be unsigned.
2019-06-07Add gfortran support for AMD GCNJeff Johnston10-3/+212
From: Kwok Cheung Yeung <kcy@codesourcery.com> This patch adds enough support for constructors/destructors and OS functions to be able to link and run gfortran programs on AMD GCN. There's no actual ability to do I/O operations on this targets, besides "write" to stdout and stderr, so most of the functions are just stubs.
2019-06-07Mark inline functions with __unused;trasz1-5/+5
prevents compiler warning when they end up being unused. Reviewed by: kib Obtained from: OpenBSD MFC after: 2 weeks Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D20185
2019-06-07sys/sys: further adoption of SPDX licensing ID tags.pfg1-0/+2
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
2019-06-03Fix vfwscanf(3) assignment suppression flag handling bugLucio Andrés Illanes Albornoz1-0/+1
newlib's vfwscanf(3) (or specifically, __SVFWSCANF_R()) fails to correctly set the assignment-suppressing character (`*') flag[1] which, when present in the formatting string, results in undefined behaviour comprising retrieving and dereferencing a pointer that was not supplied by the caller as such or at all. When compared to the vfscanf(3) implementation, this would appear to be over the missing goto match_failure statement preceded by the flags test seen below. Hence, this patch (re)introduces it. [1] <http://pubs.opengroup.org/onlinepubs/009695399/functions/fwscanf.html> --
2019-06-03Fix <sys/_types.h> issues with <stddef.h>Sebastian Huber2-5/+3
A commit from 2016 tried to address this GCC provided <stddef.h> issue #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__) /* __size_t is a typedef on FreeBSD 5, must not trash it. */ #elif defined (__VMS__) /* __size_t is also a typedef on VMS. */ #else #define __size_t #endif with an include of <stddef.h> before <sys/_types.h> in <sys/types.h>. Is is not robust enough. Do the include of <stddef.h> in <sys/_types.h> directly and request only the necessary types. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-06-03Avoid <sys/cdefs.h> dependency in <sys/_types.h>Sebastian Huber1-2/+7
Including <sys/cdefs.h> could result in cyclic header dependencies. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-06-03Avoid cyclic header dependenciesSebastian Huber2-5/+5
RTEMS uses a considerable part of FreeBSD kernel and user space sources. These sources are compiled with a __FreeBSD__ define. On 2018-06-26 Gerald Pfeifer changed the GCC provided <stddef.h> so that it includes <sys/_types.h> if __FreeBSD__ is defined. The Newlib <sys/_types.h> included <sys/lock.h> which includes <sys/cdefs.h> on RTEMS which includes <stddef.h>. To get rid of this cyclic dependency move the optional _flock_t definition to <sys/reent.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-05-22RISC-V: Add size optimized memcpy, memmove, memset and strcmp.Jim Wilson8-2/+146
This patch adds implementations of memcpy, memmove, memset and strcmp optimized for size. The changes have been tested in riscv/riscv-gnu-toolchain by riscv-dejagnu with riscv-sim.exp/riscv-sim-nano.exp.
2019-04-15Implement reduced code size "tiny" printf and putsJozef Lawrynowicz6-428/+132
"tiny" printf is derived from _vfprintf_r in libc/stdio/nano-vfprintf.c. "tiny" puts has been implemented so that it just calls write, without any other processing. Support for buffering, reentrancy and streams has been removed from these functions to achieve reduced code size. This reduced code size implementation of printf and puts can be enabled in an application by passing "--wrap printf" and "--wrap puts" to the GNU linker. This will replace references to "printf" and "puts" in user code with "__wrap_printf" and "__wrap_puts" respectively. If there is no implementation of these __wrap* functions in user code, these "tiny" printf and puts implementations will be linked into the final executable. The wrapping mechanism is supposed to be invisible to the user: - A GCC wrapper option such as "-mtiny-printf" will be added to alias these wrap commands. - If the user is unaware of the "tiny" implementation, and chooses to implement their own __wrap_printf and __wrap_puts, their own implementation will be automatically chosen over the "tiny" printf and puts from the library. Newlib must be configured with --enable-newlib-nano-formatted-io for the "tiny" printf and puts functions to be built into the library. Code size reduction examples: printf("Hello World\n") baseline - msp430-elf-gcc gcc-8_3_0-release text data bss 5638 214 26 "tiny" puts enabled text data bss 714 90 20 printf("Hello %d\n", a) baseline - msp430-elf-gcc gcc-8_3_0-release text data bss 10916 614 28 "tiny" printf enabled text data bss 4632 280 20
2019-04-15Copy prerequisite file for "tiny" printf implementationJozef Lawrynowicz1-0/+661
Use newlib/libc/stdio/nano-vfprintf.c as baseline for tiny-printf.c
2019-04-12Align comments and spaces in libgloss/arm/crt0.S and ↵Alexander Fedotov1-8/+10
newlib/libc/sys/arm/crt0.S to ease further code alignment.
2019-04-11Include code in trap.S for APCS only.Christophe Lyon1-1/+1
The code in trap.S is to support the old APCS chunked stack variant, which dates back to the Acorn days, so put it under #ifndef __ARM_EABI__. * libgloss/arm/trap.S: Use __ARM_EABI rather than PREFER_THUMB. * newlib/libc/sys/arm/trap.S: Use __ARM_EABI rather than __thumb2__.
2019-04-11Make more macro checks ARMv8-M baseline proof.Christophe Lyon1-4/+4
Commit 69f4c4029183fb26d2fcae00790881620c1978a3 improved most macro checks to be ARMv8-M baseline proof, but missed a few occurrences which otherwise fail to build when using a CPU setting such as cortex-m0 or cortex-m23. This patch brings the same changes as the ones that were committed to libgloss at that time. newlib: * libc/sys/arm/crt0.S: Use THUMB1_ONLY rather than __ARM_ARCH_6M__.
2019-03-25Add missing includes.Andrew Stubbs3-1/+4
These missing includes were causing build warnings, but also a real bug in which the "size" parameter to "write" was being passed in 32-bit, whereas it ought to be 64-bit. This led to intermittent bad behaviour.
2019-03-18AMD GCN: Implement circular buffering.Andrew Stubbs1-17/+38
The GCN port outputs stdout and stderr via a shared-memory interface. Previously the buffer was limited to 1000 write operations, which was enough for testing purposes, but easy to exhaust. This patch implements a new circular buffering system allowing a greater amount of output. The interface must allow hundreds of hardware threads to output simultaneously. The new limit is UINT32_MAX write operations. Unfortunately, there's no way to tell if the host side has also been updated. This code will misbehave unless the gcn-run from GCC is also updated (although it's fine the other way around), but that patch has already been committed. OK? Andrew Stubbs Mentor Graphics / CodeSourcery
2019-02-22stdio: drop unused O_TEXT handling on non-CygwinCorinna Vinschen1-4/+0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-19Cygwin: add secure_getenvYaakov Selkowitz1-0/+3
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2019-02-19Define u_register_t if __BSD_VISIBLESebastian Huber1-0/+2
Add u_register_t definition for FreeBSD compatibility. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Change register_t definitionSebastian Huber1-1/+1
On 64-bit targets, the register_t type must be a 64-bit integer. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Fix comment in <sys/types.h>Sebastian Huber1-1/+1
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-19Move RTEMS and XMK specific type definitionsSebastian Huber3-16/+12
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-01scandir: Add support for struct dirent::d_typeSebastian Huber1-1/+4
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-01a) Use strcoll() in opendir() and alphasort()ache1-3/+4
as POSIX 2008 requires. It also matches now how our 'ls' works for years. b) Remove comment expressed 2 fears: 1) One just simple describe how strcoll() works in _any_ context, not for directories only. Are we plan to remove strcoll() from everything just because it is little more complex than strcmp()? I doubt, and directories give nothing different here. Moreover, strcoll() used in 'ls' for years and nobody complaints yet. 2) Plain wrong statement about undefined strcoll() behaviour. strcoll() always gives predictable results, falling back to strcmp() on any trouble, see strcoll(3). No objections from -current list discussion.
2019-02-01scandir(3) previously used st_sizedas1-53/+31
to obtain an initial estimate of the array length needed to store all the directory entries. Although BSD has historically guaranteed that st_size is the size of the directory file, POSIX does not, and more to the point, some recent filesystems such as ZFS use st_size to mean something else. The fix is to not stat the directory at all, set the initial array size to 32 entries, and realloc it in powers of 2 if that proves insufficient. PR: 113668
2019-02-01Remove __P and convert to ANSI prototypes.obrien1-7/+4
* Fix SCM ID's.
2019-02-01Clean up the vcs ID stringsjhb1-3/+2
in libc's gen/ directory. - Move CSRG IDs into __SCCSID(). - When a file has been copied, consistently use 'From: <tag>' for strings referencing the version of the source file copied from in the license block comment. - Some of the 'From:' tags were using $FreeBSD$ that was being expanded on each checkout. Fix those to hardcode the FreeBSD tag from the file that was copied at the time of the copy. - When multiple strings are present list them in "chronological" order, so CSRG (__SCCSID) before FreeBSD (__FBSDID). If a file came from OtherBSD and contains a CSRG ID from the OtherBSD file, use the order CSRG -> OtherBSD -> FreeBSD. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D15831
2019-02-01Renumber copyright clause 4imp1-1/+1
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
2019-02-01scandir: Update copyright notice from FreeBSDSebastian Huber1-3/+3
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2019-02-01General further adoption of SPDX licensing ID tags.pfg1-0/+2
Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
2019-01-23Use nanf() instead of nan() in single-precision float libm math functionsJozef Lawrynowicz4-4/+4
This patch reduces code size for a few single-precision float math functions, by using nanf() instead of nan() where required.
2019-01-23Use HUGE_VALF instead of HUGE_VAL in single-precision float libm math functionsJozef Lawrynowicz16-18/+18
This patch replaces instances of "(float).*HUGE_VAL" with a direct usage of HUGE_VALF, which is also defined in math.h.
2019-01-23Remove HUGE_VAL definition from libm math functionsJozef Lawrynowicz31-186/+0
This patch removes the definitions of HUGE_VAL from some of the float math functions. HUGE_VAL is defined in newlib/libc/include/math.h, so it is not necessary to have a further definition in the math functions.
2019-01-23Remove matherr, and SVID and X/Open math library configurationsJozef Lawrynowicz75-2298/+405
Default math library configuration is now IEEE
2019-01-22time.h: Add CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARMCorinna Vinschen1-8/+12
Slightly reshuffle and add comment Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-15AMD GCN Port contributed by Andrew Stubbs <ams@codesourcery.com>Jeff Johnston31-4/+13112
Add support for the AMD GCN GPU architecture. This is primarily intended for use with OpenMP and OpenACC offloading. It can also be used for stand-alone programs, but this is intended mostly for testing the compiler and is not expected to be useful in general. The GPU architecture is highly parallel, and therefore Newlib must be configured to use dynamic re-entrancy, and thread-safe malloc. The only I/O available is a via a shared-memory interface provided by libgomp and the gcn-run tool included with GCC. At this time this is limited to stdout, argc/argv, and the return code.
2019-01-13update to Unicode 11.0Thomas Wolff4-93/+159
2019-01-13map WEOF to undefined rather than the control char categoryThomas Wolff1-1/+1
Fixes https://cygwin.com/ml/cygwin/2018-12/msg00173.html