summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
* Reduce qsort stack consumptionHakan Lindqvist2018-03-161-6/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Classical function call recursion wastes a lot of stack space. Each recursion level requires a full stack frame comprising all local variables and additional space as dictated by the processor calling convention. This implementation instead stores the variables that are unique for each recursion level in a parameter stack array, and uses iteration to emulate recursion. Function call recursion is not used until the array is full. To ensure the stack consumption isn't worsened by this design, the size of the parameter stack array is chosen to be similar to the stack frame excluding the array. Each function call recursion level can handle 8 iterative recursion levels. Stack consumption will worsen when sorting tiny arrays that do not need recursion (of 6 elements or less). It will be about equal for up to 15 elements, and be an improvement for larger arrays. The best case improvement is a stack size reduction down to about one quarter of the stack consumption before the change. A design where the parameter stack array is large enough for the worst case recursion level was rejected because it would worsen the stack consumption when sorting arrays smaller than about 1500 elements. The worst case is 31 levels on a 32-bit system. A design with a dynamic parameter array size was rejected because of limitations in some compilers.
* Ensure qsort recursion depth is boundedHakan Lindqvist2018-03-161-12/+56
| | | | | | | | | | | | | | The qsort algorithm splits the input array in three parts. The left and right parts may need further sorting. One of them is sorted by recursion, the other by iteration. This update ensures that it is the smaller part that is chosen for recursion. By choosing the smaller part, each recursion level will handle less than half the array of the previous recursion level. Hence the recursion depth is bounded to be less than log2(n) i.e. 1 level per significant bit in the array size n. The update also includes code comments explaining the algorithm.
* Correct prototypes of pthread_mutex_getprioceiling() and pthread_setschedparam()Joel Sherrill2018-03-151-2/+2
|
* [arm] Fix syscalls.c for newlib embedded syscalls buildsRichard Earnshaw2018-03-151-119/+126
| | | | | | | | | | | | | | | | | | Newlib has a build configuration where syscalls can be directly embedded in the newlib library rather than relying on libgloss. This configuration was broken recently by an update to the libgloss support for Arm that was not propagated to the syscalls interface in newlib itself. This patch restores the build. It's essentially a copy of https://sourceware.org/ml/newlib/2018/msg00128.html but there are some other minor cleanups and changes that I've made at the same time. None of those cleanups affect functionality. The prototypes of the following functions have been updated: _link, _sbrk, _getpid, _write, _swiwrite, _lseek, _swilseek, _read and _swiread. Signed-off-by: Richard Earnshaw <Richard.Earnshaw@arm.com>
* ssp: fix wchar.h with -std=c99Yaakov Selkowitz2018-03-141-2/+2
| | | | | | https://sourceware.org/ml/newlib/2018/msg00261.html Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Fix alloc_align and alloc_size macros for multiple argumentsYaakov Selkowitz2018-03-142-4/+4
| | | | | | | | https://sourceware.org/ml/newlib/2018/msg00263.html This is a follow-up to commit 4564b30f331a067e71b25308ac7c8a85ceb4b122. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ctype: align size of category bit fields to small targets needsCorinna Vinschen2018-03-141-2/+2
| | | | | | | | | | | | | | | | E.g. arm ABI requires -fshort-enums for bare-metal toolchains. Given there are only 29 category enums, the compiler chooses an 8 bit enum type, so a size of 11 bits for the bitfield leads to a compile time error: error: width of 'cat' exceeds its type enum category cat: 11; ^~~ Fix this by aligning the size of the category members to byte borders. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Revert "ctype: align size of category bit fields to small targets needs"Corinna Vinschen2018-03-141-2/+2
| | | | | | This reverts commit e98d3eb3eb9b6abd897e102031a14b7057641a65. It has accidentally included some work in progress.
* fix/enhance Unicode table generation scriptsThomas Wolff2018-03-142-18/+53
| | | | | | | | | | | Scripts do not try to acquire Unicode data by best-effort magic anymore. Options supported: -h for help -i to copy Unicode data from /usr/share/unicode/ucd first -u to download Unicode data from unicode.org first If (despite of -i or -u if given) the necessary Unicode files are not available locally, table generation is skipped, but no error code is returned, so not to obstruct the build process if called from a Makefile.
* ctype: align size of category bit fields to small targets needsCorinna Vinschen2018-03-141-2/+2
| | | | | | | | | | | | | | | | E.g. arm ABI requires -fshort-enums for bare-metal toolchains. Given there are only 29 category enums, the compiler chooses an 8 bit enum type, so a size of 11 bits for the bitfield leads to a compile time error: error: width of 'cat' exceeds its type enum category cat: 11; ^~~ Fix this by aligning the size of the category members to byte borders. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* towctrans_l: Always return a value from helper functionsCorinna Vinschen2018-03-131-19/+49
| | | | | | | | | | | | touupper and toulower didn't return a value in all cases. Worse, this only broke Cygwin when building without optimization for debug purposes. Why GCC neglects to notice this is a mystery. While at it, fix formatting. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* rtems/.../dirent.h: Add alphasort() prototypeJoel Sherrill2018-03-131-0/+1
|
* Correct alloc_size annotation on reallocarray()Jon Turney2018-03-131-2/+1
| | | | Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* make target for explicit Unicode data tables generationThomas Wolff2018-03-121-0/+9
| | | | | Run 'make unidata' in newlib target directory to generate Unicode data tables for libc functions wcwidth, tow* and isw*.
* character data generationThomas Wolff2018-03-123-0/+237
|
* use generated character dataThomas Wolff2018-03-1238-2681/+439
| | | | | | | | | | | The tow* functions use an included case conversion table which can be generated from Unicode data. The isw* functions use a character categories table (provided by categories.c) which can be generated from Unicode data. Delegation between current-locale and specific-locale-dependent functions was reverted towards the generic locale-dependent functions (*_l.c); this is however only relevant on systems with non-Unicode wide character locales, thus not on Cygwin.
* generated character category data, Unicode 10.0Thomas Wolff2018-03-122-0/+2115
| | | | | | Table categories.t and tag enumeration categories.cat provide character class data for most of the isw* functions. These data are generated from Unicode data.
* generated case conversion data, Unicode 10.0Thomas Wolff2018-03-121-0/+304
| | | | | | Table caseconv.t provides case conversion data for the tow* functions, especially towupper and towlower. These data are generated from Unicode data.
* width data generationThomas Wolff2018-03-125-0/+1388
|
* use generated width dataThomas Wolff2018-03-121-126/+24
|
* generated width data, Unicode 10.0Thomas Wolff2018-03-123-0/+201
| | | | | These tables provide character width properties for use by the wcwidth/wcswidth functions. They are generated from Unicode.
* RTEMS: Use int for _CLOCKID_T_Sebastian Huber2018-03-061-0/+3
| | | | | | | | | Linux and FreeBSD use int as well. In addition, this fixes an Ada incompatiblity problem on 64-bit targets. See also GCC: gcc/ada/libgnarl/s-osinte__rtems.ads Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Make _CLOCKID_T_ system configurableSebastian Huber2018-03-061-0/+3
| | | | | | | Let systems optionally provide the _CLOCKID_T_ type via <machine/_types.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Locale modifier @cjkwide to adjust ambiguous-width in non-CJK localesThomas Wolff2018-03-051-16/+23
| | | | | | | | | | Locale modifier @cjkwide makes Unicode "ambiguous width" characters wide. So ambiguous width characters can be enforced to have width 2 even in non-CJK locales. This gives e.g. users of "Powerline symbols" the opportunity to adjust their width to the desired behaviour (and the behaviour apparently expected by some tools) without having to set a CJK locale and without losing consistence of terminal character width with wcwidth/wcswidth locale width.
* Add global stdio streams support for reent small.Our Air Quality2018-03-013-11/+56
|
* add forward declaration to __cxa_atexit to aeabi_atexit, to prevent warningsJaap de Wolff2018-02-161-0/+3
|
* Add prototype to _malloc_lock() and *unlock() to malloc.h, and inlude this ↵Jaap de Wolff2018-02-162-15/+5
| | | | from nano-mallocr.c
* Add define _COMPILING_NEWLIB for arm to configure.host, as it is obviously ↵Jaap de Wolff2018-02-161-0/+1
| | | | | | needed Signed-off-by: Jaap de Wolff <jaap@stretch.de-wolff.org>
* newlib: drop Cygwin license from sys/select.hcygwin-2_10_0-releaseCorinna Vinschen2018-02-021-11/+0
| | | | | | This license was accidentally retained when moving the file from Cygwin to newlib. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix vprintf and vfscanf for GCC PR 14577Jon Beniston2018-02-012-33/+24
|
* epiphany: Additional setjmp() and longjmp() symsSebastian Huber2018-01-311-0/+4
| | | | | | | At least with Binutils 2.30 and GCC 7.3 we need symbol definitions without the leading underscore. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* ssp: do not use __ssp_protected_ symbol prefixesYaakov Selkowitz2018-01-261-1/+0
| | | | | | | | | This is a NetBSD-specific detail which does not apply to Newlib, causing linking issues in certain scenarios: https://cygwin.com/ml/cygwin/2018-01/msg00189.html Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Disable powf/log2?f/exp2?f optimization for single-precision Arm FPUThomas Preudhomme2018-01-251-1/+3
| | | | | | | | | | | | | | | | New optimized powf, logf, log2f, expf and exp2f yield worse performance on Arm targets with only single precision instructions because the double precision arithmetic is then implemented via softfloat routines. This patch uses the old implementation when double precision instructions are not available on Arm targets. Testing: Built newlib with GCC's rmprofile Arm multilibs and compared before/after -> only the above functions are changed and calls to them (name change from logf to __ieee754_logf and similar). Testing the changed function on a panel of values yields the same result before the original patches to improve them and after this one. Double checking the performance by looping the same panel of values being tested on Arm Cortex-M4 does show the performance regression is fixed.
* Guard langinfo.h nl_item from multiple typedefsYaakov Selkowitz2018-01-191-0/+3
| | | | | | This is a prerequisite of adding nl_types.h support to Cygwin. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Fix syntax error in exit.cOrlando Arias2018-01-191-1/+1
| | | | | | This patch fixes a syntax error in exit.c that was introduced during the ANSI-fication of newlib. The patch fixes a compile-time issue that arises when newlib is configured with the --enable-lite-exit feature.
* Bump release to 3.0.0 for yearly snapshotnewlib-snapshot-20180118newlib-3.0.0Jeff Johnston2018-01-18108-1156/+1153
| | | | - major release required due to removal of K&R support
* RISC-V: Fix alignment issue in sigjmp_bufKito Cheng2018-01-181-1/+3
|
* ansification: remove ansidecl.h from makedocYaakov Selkowitz2018-01-172-176/+51
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: fix makedoc for ANSI CYaakov Selkowitz2018-01-171-2/+2
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _HAVE_STDCYaakov Selkowitz2018-01-1736-440/+1
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _EXFUN, _EXFUN_NOTHROWYaakov Selkowitz2018-01-1789-1800/+1742
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _EXFNPTR, _EXPARMYaakov Selkowitz2018-01-1713-81/+77
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _DEFUNYaakov Selkowitz2018-01-17622-2372/+1220
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _VOLATILE, _SIGNEDYaakov Selkowitz2018-01-171-4/+0
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _VOIDYaakov Selkowitz2018-01-1739-104/+102
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _DEFUN_VOIDYaakov Selkowitz2018-01-1743-89/+87
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _CAST_VOIDYaakov Selkowitz2018-01-1717-38/+36
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _PTRYaakov Selkowitz2018-01-1771-228/+226
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _VOID_PTRYaakov Selkowitz2018-01-1718-148/+145
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ansification: remove _PARAMSYaakov Selkowitz2018-01-1730-379/+373
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>