aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
2017-11-30newlib: vf[w]scanf: Only return from a single point to simplify cleanupCorinna Vinschen2-4/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30string: add wmempcpyYaakov Selkowitz5-38/+85
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-30RTEMS: Add semaphore <sys/lock.h> functionsSebastian Huber1-0/+4
Declare semaphore try wait and post binary functions. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-11-30RTEMS: Timed wait by ticks <sys/lock.h> functionsSebastian Huber1-0/+16
Declare timed wait by ticks functions. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-11-30RTEMS: Add set/get name <sys/lock.h> functionsSebastian Huber1-1/+71
Add inline functions to set/get the name. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-11-29ssp: add build infrastructureYaakov Selkowitz8-9/+798
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add documentationYaakov Selkowitz3-0/+46
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add Object Size Checking for unistd.h, part 1Yaakov Selkowitz2-0/+58
The implementation is from NetBSD, with the addition of feature test macros for readlink. glibc also wraps the following functions: confstr, getdomainname, getgroups, gethostname, getlogin_r, getwd, pread, readlinkat, ttyname_r. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add Object Size Checking for stdio.h, part 1Yaakov Selkowitz7-0/+416
The implementation is mostly from NetBSD, except for switching fgets to pure inline, and the addition of fgets_unlocked, fread, and fread_unlocked for parity with glibc. The following functions are also guarded in glibc: asprintf, dprintf, fprintf, printf, vasprintf, vdprintf, vfprintf, vprintf. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add Object Size Checking for strings.hYaakov Selkowitz2-0/+59
The implementation is from NetBSD, with the addition of explicit_bzero for parity with glibc. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add Object Size Checking for string.hYaakov Selkowitz12-0/+652
The implementation is from NetBSD, with the addition of mempcpy (a GNU extension) for parity with glibc and libssp. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add Object Size Checking common codeYaakov Selkowitz3-1/+107
The Object Size Checking (-D_FORTIFY_SOURCE=*) functionality provides wrappers around functions suspectible to buffer overflows. While independent from Stack Smashing Protection (-fstack-protector*), they are often used and implemented together. While GCC also provides an implementation in libssp, it is completely broken (CVE-2016-4973, RHBZ#1324759) and seemingly unfixable, as there is no reliable way for a preprocessor macro to trigger a link flag. Therefore, adding this here is necessary to make it work. Note that this does require building gcc with --disable-libssp and gcc_cv_libc_provides_ssp=yes. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29ssp: add APIs for Stack Smashing ProtectionYaakov Selkowitz1-0/+45
Compiling with any of the -fstack-protector* flags requires the __stack_chk_guard data import (which needs to be initialized) and the __stack_chk_fail{,_local} functions. While GCC's own libssp can provide these, it is better that we provide these ourselves. The implementation is custom due to being OS-specific. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29newlib: [w]scanf: Fix behaviour on matching failureCorinna Vinschen2-22/+3
The special handling of %\0 in [w]scanf is flawed. It's just a matching failure and should be handled as such. scanf also fakes an int input value on %X with X being an invalid conversion char. This is also just a matching failure and should be handled the same way as %\0. There's no indication of the reason for this "disgusting backwards compatibility hacks" in the logs, given this code made it into newlib before setting up the CVS repo. Just handle these cases identically as matching failures. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-28Make __nonnull macro compatible with glibcYaakov Selkowitz4-5/+5
This form allows for multiple arguments, e.g. __nonnull((1,2)). Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28cygwin: define _POSIX_TIMEOUTSYaakov Selkowitz1-1/+1
Since commit 8128f5482f2b1889e2336488e9d45a33c9972d11, we have all the non-tracing functions listed in posixoptions(7). The tracing functions are gated by their own option, and are obsolecent anyway. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-22Add the Aarch64 SVE specific HWCAP_SVE defineJeff Johnston1-0/+1
Checking in change from Alan Hayward <Alan.Hayward@arm.com> Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
2017-11-20RTEMS: Add missing __getreent() to crt0Sebastian Huber1-0/+1
Default implementation was removed for RTEMS by b1a388799dc98e6d1451fb73aa71097cbf9f37d9. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-11-20RTEMS: Add missing functions to crt0Sebastian Huber1-5/+10
This helps to get some more features from libstdc++. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-11-14Cygwin: fcntl.h: Use test macros to guard non-standard open flagsCorinna Vinschen1-4/+12
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14Cygwin: fcntl.h: Define O_NOATIMECorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14Cygwin: fcntl.h: Define O_TMPFILE and implement itCorinna Vinschen1-0/+2
Difference to Linux: We can't create files which don't show up in the filesystem due to OS restrictions. As a kludge, make a (half-hearted) attempt to hide the file in the filesystem. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-14newlib/libc/stdlib/realloc.c: fix variable nameFlorian Schmidt1-1/+1
The variable doesn't follow the convention of having the same name as the function it's bundled with. Furthermore, it clashes with the variable of the same name in newlib/libc/stdlib/calloc.c. Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
2017-11-13newlib/.../getreent.c: Allow to be provided by host and do so for RTEMSJoel Sherrill2-2/+10
RTEMS provides the option to have a global or per-thread reentrancy as part of application configuration. As part of this, RTEMS provides the implementation of __getreent() as appropriate. Allow the target to determine if this method is present in libc.a.
2017-11-03Make ffsl() and ffsll() BSD-visibleSebastian Huber1-3/+1
Since glibc 2.27, they are visible via _DEFAULT_SOURCE (__USE_MISC): https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/ffs.3?id=247bbcf00c9a425ab0ad6e303ec8718e4ba844a6 In FreeBSD, they are guarded by __BSD_VISIBLE. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-11-02newlib/configure.host: Remove obsolete definition of ↵Joel Sherrill1-2/+0
_I386MACH_ALLOW_HW_INTERRUPTS The *-*-rtems* targets defined this even though the conditional was no longer present in i386/setjmp.S.
2017-10-26RTEMS: Remove internal timecounter APISebastian Huber1-29/+4
Change copyright. Original BSD content moved to <machine/_kernel_time.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-20fix internal __ieee754_expf and __ieee754_logf callsSzabolcs Nagy1-0/+11
The recently added new math code inlines error handling instead of using error handling wrappers around __ieee754* internal symbols, and thus the __ieee754* symbols are no longer provided. However __ieee754_expf and __ieee754_logf are used in the implementation of a number of other math functions. These symbols are safe to redirect to the external expf and logf symbols, because those names are always reserved when single precision math functions are reserved and the additional error handling code is either not reached or there will be an error in the final result that will override an internal spurious errno setting. For consistency all of __ieee754_expf, __ieee754_logf and __ieee754_powf are redirected using a macro.
2017-10-13New expf, exp2f, logf, log2f and powf implementationsSzabolcs Nagy24-88/+1339
Based on code from https://github.com/ARM-software/optimized-routines/ This patch adds a highly optimized generic implementation of expf, exp2f, logf, log2f and powf. The new functions are not only faster (6x for powf!), but are also smaller and more accurate. In order to achieve this, the algorithm uses double precision arithmetic for accuracy, avoids divisions and uses small table lookups to minimize the polynomials. Special cases are handled inline to avoid the unnecessary overhead of wrapper functions and set errno to POSIX requirements. The new functions are added under newlib/libm/common, but the old implementations are kept (in newlib/libm/math) for non-IEEE or pre-C99 systems. Targets can enable the new math code by defining __OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h, users can override the default by defining __OBSOLETE_MATH. Currently the new code is enabled for AArch64 and AArch32 with VFP. Targets with a single precision FPU may still prefer the old implementation. libm.a size changes: arm: -1692 arm/thumb/v7-a/nofp: -878 arm/thumb/v7-a+fp/hard: -864 arm/thumb/v7-a+fp/softfp: -908 aarch64: -1476
2017-10-13RTEMS: Fix _PTHREAD_MUTEX_INITIALIZERSebastian Huber1-1/+1
Add missing braces around initializer. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-09Fix typo with newlib-long-time_t default value.Michael Haubenwallner2-2/+2
Fix typo for newlib-long-time_t to leave newlib-nano-malloc alone.
2017-10-05RTEMS: Make pthread_mutex_t self-containedSebastian Huber1-2/+28
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-05RTEMS: Make pthread_cond_t self-containedSebastian Huber1-2/+6
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-05RTEMS: Make pthread_rwlock_t self-containedSebastian Huber1-2/+7
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-05RTEMS: Make pthread_barrier_t self-containedSebastian Huber1-1/+7
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-05RTEMS: Make sem_t self-containedSebastian Huber1-2/+6
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-10-05RTEMS: Optimize pthread_once_tSebastian Huber2-7/+6
Reduce size of pthread_once_t and make it zero-initialized. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-19newlib/libm/complex/cargl.c change imag() real() to cimagl() creall()newlib-snapshot-20170922Brian Inglis1-1/+1
2017-09-19Fix warnings and documentation in strnstr.cSebastian Huber1-4/+3
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-07Change time_t to 64-bit by defaultSebastian Huber6-3/+59
In order to avoid the year 2038 problem, define time_t to a signed integer with at least 64-bits. The type for time_t can be forced to long with the --enable-newlib-long-time_t configure option or with the _USE_LONG_TIME_T system configuration define. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-07Remove harmful casts in gmtime_r()Sebastian Huber1-2/+2
In case time_t is long, then the cast to long is a nop. In case time_t is __int_least64_t, then the cast to long may truncate the value before the division. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-07Let RTEMS provide clock()Sebastian Huber1-1/+1
Newlib uses _times_r() in clock(). The problem is that the _times_r() clock frequency is defined by sysconf(_SC_CLK_TCK). The clock frequency of clock() is the constant CLOCKS_PER_SEC. FreeBSD uses getrusage() for clock(). Since RTEMS has only one process, the implementation can be simplified. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-04stdio.h: Don't define unlocked macros using static inline on C++cygwin-2_9_0-releaseCorinna Vinschen1-1/+1
In C++, the usage of static inline functions for getchar_unlocked and putchar_unlocked may result in error messages like error: ‘_putchar_unlocked’ was not declared in this scope Fix this by not using the _getchar_unlocked and _putchar_unlocked macros in C++. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-30include: fix ffs, fls guardsYaakov Selkowitz1-2/+4
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-08-30newlib: string/Makefile.am (CHEWOUT_FILES): Add strnstr.defCorinna Vinschen2-2/+2
Regenerate strings/Makefile.in Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-30newlib: strnstr: drop traditional synopisisCorinna Vinschen1-7/+0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-08-30Add man page entry for strnstr.c.Sichen Zhao2-0/+43
2017-08-30Modify strnstr.c.Sichen Zhao1-55/+10
2017-08-28Fix compile error due to new strnstr()Sebastian Huber1-43/+0
Remove local strnstr() implementation to fix compile error: newlib/libc/iconv/lib/aliasesi.c:53:8: error: conflicting types for 'strnstr' _DEFUN(strnstr, (haystack, needle, length), ^ In file included from newlib/libc/iconv/lib/aliasesi.c:29:0: newlib/libc/include/string.h:125:10: note: previous declaration of 'strnstr' was here char *strnstr(const char *, const char *, size_t) __pure; ^~~~~~~ Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-08-25newlib: rebuild string/Makefile.inCorinna Vinschen1-27/+49
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>