summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
* ssp: add APIs for Stack Smashing ProtectionYaakov Selkowitz2017-11-291-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>
* newlib: [w]scanf: Fix behaviour on matching failureCorinna Vinschen2017-11-292-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>
* Make __nonnull macro compatible with glibcYaakov Selkowitz2017-11-284-5/+5
| | | | | | This form allows for multiple arguments, e.g. __nonnull((1,2)). Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* cygwin: define _POSIX_TIMEOUTSYaakov Selkowitz2017-11-281-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>
* Add the Aarch64 SVE specific HWCAP_SVE defineJeff Johnston2017-11-221-0/+1
| | | | | | Checking in change from Alan Hayward <Alan.Hayward@arm.com> Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
* RTEMS: Add missing __getreent() to crt0Sebastian Huber2017-11-201-0/+1
| | | | | | | Default implementation was removed for RTEMS by b1a388799dc98e6d1451fb73aa71097cbf9f37d9. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Add missing functions to crt0Sebastian Huber2017-11-201-5/+10
| | | | | | This helps to get some more features from libstdc++. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Cygwin: fcntl.h: Use test macros to guard non-standard open flagsCorinna Vinschen2017-11-141-4/+12
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fcntl.h: Define O_NOATIMECorinna Vinschen2017-11-141-0/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fcntl.h: Define O_TMPFILE and implement itCorinna Vinschen2017-11-141-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>
* newlib/libc/stdlib/realloc.c: fix variable nameFlorian Schmidt2017-11-141-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>
* newlib/.../getreent.c: Allow to be provided by host and do so for RTEMSJoel Sherrill2017-11-132-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.
* Make ffsl() and ffsll() BSD-visibleSebastian Huber2017-11-031-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>
* newlib/configure.host: Remove obsolete definition of ↵Joel Sherrill2017-11-021-2/+0
| | | | | | | _I386MACH_ALLOW_HW_INTERRUPTS The *-*-rtems* targets defined this even though the conditional was no longer present in i386/setjmp.S.
* RTEMS: Remove internal timecounter APISebastian Huber2017-10-261-29/+4
| | | | | | | Change copyright. Original BSD content moved to <machine/_kernel_time.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* fix internal __ieee754_expf and __ieee754_logf callsSzabolcs Nagy2017-10-201-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.
* New expf, exp2f, logf, log2f and powf implementationsSzabolcs Nagy2017-10-1324-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
* RTEMS: Fix _PTHREAD_MUTEX_INITIALIZERSebastian Huber2017-10-131-1/+1
| | | | | | Add missing braces around initializer. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix typo with newlib-long-time_t default value.Michael Haubenwallner2017-10-092-2/+2
| | | | Fix typo for newlib-long-time_t to leave newlib-nano-malloc alone.
* RTEMS: Make pthread_mutex_t self-containedSebastian Huber2017-10-051-2/+28
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Make pthread_cond_t self-containedSebastian Huber2017-10-051-2/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Make pthread_rwlock_t self-containedSebastian Huber2017-10-051-2/+7
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Make pthread_barrier_t self-containedSebastian Huber2017-10-051-1/+7
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Make sem_t self-containedSebastian Huber2017-10-051-2/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Optimize pthread_once_tSebastian Huber2017-10-052-7/+6
| | | | | | Reduce size of pthread_once_t and make it zero-initialized. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* newlib/libm/complex/cargl.c change imag() real() to cimagl() creall()newlib-snapshot-20170922Brian Inglis2017-09-191-1/+1
|
* Fix warnings and documentation in strnstr.cSebastian Huber2017-09-191-4/+3
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Change time_t to 64-bit by defaultSebastian Huber2017-09-076-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>
* Remove harmful casts in gmtime_r()Sebastian Huber2017-09-071-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>
* Let RTEMS provide clock()Sebastian Huber2017-09-071-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>
* stdio.h: Don't define unlocked macros using static inline on C++cygwin-2_9_0-releaseCorinna Vinschen2017-09-041-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>
* include: fix ffs, fls guardsYaakov Selkowitz2017-08-301-2/+4
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* newlib: string/Makefile.am (CHEWOUT_FILES): Add strnstr.defCorinna Vinschen2017-08-302-2/+2
| | | | | | Regenerate strings/Makefile.in Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* newlib: strnstr: drop traditional synopisisCorinna Vinschen2017-08-301-7/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add man page entry for strnstr.c.Sichen Zhao2017-08-302-0/+43
|
* Modify strnstr.c.Sichen Zhao2017-08-301-55/+10
|
* Fix compile error due to new strnstr()Sebastian Huber2017-08-281-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>
* newlib: rebuild string/Makefile.inCorinna Vinschen2017-08-251-27/+49
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Port strnstr.c to newlib.Sichen Zhao2017-08-252-0/+4
|
* Import strnstr.c from FreeBSD.Sichen Zhao2017-08-251-0/+65
|
* Revert "headers: avoid bareword attributes" for clangEric Blake2017-08-251-14/+16
| | | | | | | | | | | | | | | This reverts most of commit 979d467ff6e39ee5c52cf1aac7a6c9c63058141c. We cannot avoid some bareword attributes until clang is fixed to properly support __-decorated attributes; see this bug: https://bugs.llvm.org/show_bug.cgi?id=34319 The macros in question expand to the empty string under gcc, so only compilation under clang is affected, and since clang has the bug, the obvious solution is to roll back the changes, and document the issue. Signed-off-by: Eric Blake <eblake@redhat.com>
* RTEMS: Use __uint64_t for _CLOCK_T_Sebastian Huber2017-08-251-0/+3
| | | | | | | | This addresses: https://devel.rtems.org/ticket/2135 Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Make _CLOCK_T_ system configurableSebastian Huber2017-08-251-0/+3
| | | | | | | Let systems optionally provide the _CLOCK_T_ type via <machine/_types.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* newlib/libc/time/strptime.c(strptime_l) add %F %s support for strptimeBrian Inglis2017-08-251-2/+32
|
* Add myself to RISC-V Port MaintainerKito Cheng2017-08-211-0/+1
|
* Change license to FreeBSD License for RISC-VKito Cheng2017-08-2112-12/+12
| | | | | | - For prevent confuse about what BSD license variant we used, 2- or 3-clause license, we change the license to FreeBSD license to make it unambiguously refers to the 2-clause license.
* cygwin: Implement renameat2Ken Brown2017-08-191-0/+3
| | | | | | Define the RENAME_NOREPLACE flag in <cygwin/fs.h> as defined on Linux in <linux/fs.h>. The other RENAME_* flags defined on Linux are not supported.
* Add RISC-V port for libmKito Cheng2017-08-1719-1/+7282
| | | | | | Contributor list: - Michael Neilly <mneilly@yahoo.com> - Kito Cheng <kito.cheng@gmail.com>
* headers: avoid bareword attributesEric Blake2017-08-172-15/+15
| | | | | | | | | Always use the __-decorated form of an attribute name in public headers, as the bareword form is in the user's namespace, and we don't want compilation to break just because the user defines the bareword to mean something else. Signed-off-by: Eric Blake <eblake@redhat.com>
* Add RISC-V port for newlibKito Cheng2017-08-1624-2/+7185
| | | | | | | | Contributor list: - Andrew Waterman <andrew@sifive.com> - Palmer Dabbelt <palmer@dabbelt.com> - Kito Cheng <kito.cheng@gmail.com> - Scott Beamer <sbeamer@eecs.berkeley.edu>