summaryrefslogtreecommitdiffstats
path: root/newlib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Arrange for text mode on stdin, stdout and stderr.Kaz Kylheku2017-11-171-0/+20
| | | | | | * newlib/libc/stdio/findfp.c (__sinit): Add the Cygwin-specific __SCLE (stream convert line endings) flag when calling the std function to initializing the reent structure's _stdin, _stdout and _stderr members.
* Default stdio streams to text mode.Kaz Kylheku2017-11-161-2/+2
| | | | | | | | * newlib/libc/stdio/flags.c (__sflags): Enable for Cygwin the piece of code which adds the O_TEXT mode if O_BINARY is not present. And, also, fix that piece of code's incorrect use of the | operator to test a flag instead of &.
* 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
|
* 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.
* 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-1623-2/+7176
| | | | | | | | Contributor list: - Andrew Waterman <andrew@sifive.com> - Palmer Dabbelt <palmer@dabbelt.com> - Kito Cheng <kito.cheng@gmail.com> - Scott Beamer <sbeamer@eecs.berkeley.edu>
* newlib: regenerate libc/stdlib/Makefile.amCorinna Vinschen2017-08-111-9/+36
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Define sigsetjmp/siglongjmp only if __POSIX_VISIBLEKen Brown2017-08-071-2/+2
|
* Proper locking for getchar() and putchar()Sebastian Huber2017-08-071-7/+32
| | | | | | | | | | | | | Add internal inline functions _getchar_unlocked() and _putchar_unlocked() if __CUSTOM_FILE_IO__ is not defined. These functions get _REENT only once. Use them for getchar_unlocked() and putchar_unlocked(). Define getchar() and putchar() to these unlocked internal functions if __SINGLE_THREAD__ is defined, otherwise use the external functions to use proper locking of the FILE object. Assumes that __SINGLE_THREAD__ is not defined if __CYGWIN__ is defined. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Importing wcstoumax inttypes method from FreeBSD.Aditya Upadhyay2017-08-023-0/+160
|
* Importing wcstoimax inttypes method from FreeBSD.Aditya Upadhyay2017-08-023-0/+161
|
* Importing strtoumax inttypes method from FreeBSD.Aditya Upadhyay2017-08-023-0/+154
|
* Importing strtoimax inttypes method from FreeBSD.Aditya Upadhyay2017-08-023-0/+182
|
* Add elf.h to newlibYaakov Selkowitz2017-08-021-0/+3146
| | | | | | | This is copied from musl (MIT license). This is newer and more thorough than that of FreeBSD currently shipped only on Cygwin. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* stdio: Fix make rule overrideSebastian Huber2017-07-282-10/+0
| | | | | | The Makefile.am contained two rules for the vfwscanf object. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* newlib: regenerate stdlib/Makefile.inCorinna Vinschen2017-07-281-33/+62
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Importing imaxdiv inttypes method from FreeBSD.Aditya Upadhyay2017-07-282-0/+49
|
* Importing imaxabs inttypes method from FreeBSD.Aditya Upadhyay2017-07-282-0/+37
|
* cygwin: Set __STDC_ISO_10646__ to Unicode 5.2 valueCorinna Vinschen2017-07-261-4/+3
| | | | | | Now that XP is not supported anymore we can freely do that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* [arm] Fix strcpy for unified syntax on ARMv4t thumb.Richard Earnshaw2017-07-211-1/+1
| | | | | ARMv4t does not support mov between two low registers. Now we use unified syntax mov instructions need converting to movs.
* MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being usednewlib-snapshot-20170720Jozef Lawrynowicz2017-07-201-0/+1
|
* arm: Update strcpy.c to use UAL syntax.Ian Tessier via newlib2017-07-201-6/+7
| | | | | | | | | | | | | With this change the arm platform can now be fully compiled with Clang. Tested by comparing the output with GCC 4.8.2, and Clang 4.0, using a variety of arches, big/little endianness, and arm/thumb mode to verify the generated assembly output matches between GCC vs Clang with UAL, and also GCC with UAL vs GCC with non-UAL, for all preprocessor code blocks. The only difference found is an extra nop at the end of the function when compiled with GCC using armv7-a/thumb/little-endian/-O2 compared to Clang. The nop is not emitted when compiled in big-endian mode.
* Synchronize RTEMS <sys/bitset.h> with FreeBSDSebastian Huber2017-07-121-5/+5
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Synchronize RTEMS <sys/bitset.h> with FreeBSDSebastian Huber2017-07-101-1/+16
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Rename __in and __out in headers to avoid collision with Windows APIsDavid Macek2017-07-071-9/+9
| | | | | * string.h: Local variables in expansion of strdupa and strndupa * sys/wait.h: Fields in anonymous union in expansion of __wait_status_to_int
* Fixed warnings for some long double complex methodsAditya Upadhyay2017-07-051-5/+5
|
* Add ffsl(), ffsll(), fls(), flsl(), flsll()Sebastian Huber2017-07-058-25/+240
| | | | | | | Use compiler builtin for ffs(). Remove duplicate implementation from Cygwin. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Synchronize <strings.h> with latest FreeBSDSebastian Huber2017-07-052-59/+62
| | | | | | | | | | Include <strings.h> in <string.h> if __BSD_VISIBLE like on FreeBSD. Remove redundant declarations from <string.h>. Make ffsl(), ffsll(), strncasecmp(), strcasecmp_l(), and strncasecmp_l() visible via __BSD_VISIBLE instead of __GNU_VISIBLE. Add fls(), flsl(), and flsll() to <strings.h> if __BSD_VISIBLE. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Implement bzero() via memset()Sebastian Huber2017-07-051-8/+5
| | | | | | | Use memset() to implement bzero() to profit from machine-specific memset() optimizations. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Feature test macros overhaul: unistd.h, part 2cygwin-2_8_1-releaseYaakov Selkowitz2017-06-301-4/+17
| | | | | | | This fixes commit f70aad3de4d845f8b720010a2f8817db842d81e8 as well as some other functions which were never properly guarded. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Add --enable-newlib-global-stdio-streamsSebastian Huber2017-06-301-0/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Enable _REENT_GLOBAL_STDIO_STREAMS for RTEMSSebastian Huber2017-06-302-1/+2
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Introduce _REENT_GLOBAL_STDIO_STREAMSSebastian Huber2017-06-302-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Newlib, the stdio streams are defined to thread-specific pointers _reent::_stdin, _reent::_stdout and _reent::_stderr. In case _REENT_SMALL is not defined, then these pointers are initialized via _REENT_INIT_PTR() or _REENT_INIT_PTR_ZEROED() to thread-specific FILE objects provided via _reent::__sf[3]. There are two problems with this (at least in case of RTEMS). (1) The thread-specific FILE objects are closed by _reclaim_reent(). This leads to problems with language run-time libraries that provide wrappers to the C/POSIX stdio streams (e.g. C++ and Ada), since they use the thread-specific FILE objects of the initialization thread. In case the initialization thread is deleted, then they use freed memory. (2) Since thread-specific FILE objects are used with a common output device via file descriptors 0, 1 and 2, the locking at FILE object level cannot ensure atomicity of the output, e.g. a call to printf(). Introduce a new Newlib configuration option _REENT_GLOBAL_STDIO_STREAMS to enable the use of global stdio FILE objects. As a side-effect this reduces the size of struct _reent by more than 50%. The _REENT_GLOBAL_STDIO_STREAMS should not be used without _STDIO_CLOSE_PER_REENT_STD_STREAMS. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add stdin_init(), stdout_init() and stderr_init()Sebastian Huber2017-06-301-17/+33
| | | | | | This simplifies further changes in this area. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Remove superfluous parameter from std()Sebastian Huber2017-06-301-7/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Optimized memcmpWilco Dijkstra2017-06-291-193/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an optimized memcmp for AArch64. This is a complete rewrite using a different algorithm. The previous version split into cases where both inputs were aligned, the inputs were mutually aligned and unaligned using a byte loop. The new version combines all these cases, while small inputs of less than 8 bytes are handled separately. This allows the main code to be sped up using unaligned loads since there are now at least 8 bytes to be compared. After the first 8 bytes, align the first input. This ensures each iteration does at most one unaligned access and mutually aligned inputs behave as aligned. After the main loop, process the last 8 bytes using unaligned accesses. This improves performance of (mutually) aligned cases by 25% and unaligned by >500% (yes >6 times faster) on large inputs. ChangeLog: 2017-06-28 Wilco Dijkstra <wdijkstr@arm.com> * newlib/libc/machine/aarch64/memcmp.S (memcmp): Rewrite of optimized memcmp. GLIBC benchtests/bench-memcmp.c performance comparison for Cortex-A53: Length 1, alignment 1/ 1: 153% Length 1, alignment 1/ 1: 119% Length 1, alignment 1/ 1: 154% Length 2, alignment 2/ 2: 121% Length 2, alignment 2/ 2: 140% Length 2, alignment 2/ 2: 121% Length 3, alignment 3/ 3: 105% Length 3, alignment 3/ 3: 105% Length 3, alignment 3/ 3: 105% Length 4, alignment 4/ 4: 155% Length 4, alignment 4/ 4: 154% Length 4, alignment 4/ 4: 161% Length 5, alignment 5/ 5: 173% Length 5, alignment 5/ 5: 173% Length 5, alignment 5/ 5: 173% Length 6, alignment 6/ 6: 145% Length 6, alignment 6/ 6: 145% Length 6, alignment 6/ 6: 145% Length 7, alignment 7/ 7: 125% Length 7, alignment 7/ 7: 125% Length 7, alignment 7/ 7: 125% Length 8, alignment 8/ 8: 111% Length 8, alignment 8/ 8: 130% Length 8, alignment 8/ 8: 124% Length 9, alignment 9/ 9: 160% Length 9, alignment 9/ 9: 160% Length 9, alignment 9/ 9: 150% Length 10, alignment 10/10: 170% Length 10, alignment 10/10: 137% Length 10, alignment 10/10: 150% Length 11, alignment 11/11: 160% Length 11, alignment 11/11: 160% Length 11, alignment 11/11: 160% Length 12, alignment 12/12: 146% Length 12, alignment 12/12: 168% Length 12, alignment 12/12: 156% Length 13, alignment 13/13: 167% Length 13, alignment 13/13: 167% Length 13, alignment 13/13: 173% Length 14, alignment 14/14: 167% Length 14, alignment 14/14: 168% Length 14, alignment 14/14: 168% Length 15, alignment 15/15: 168% Length 15, alignment 15/15: 173% Length 15, alignment 15/15: 173% Length 1, alignment 0/ 0: 134% Length 1, alignment 0/ 0: 127% Length 1, alignment 0/ 0: 119% Length 2, alignment 0/ 0: 94% Length 2, alignment 0/ 0: 94% Length 2, alignment 0/ 0: 106% Length 3, alignment 0/ 0: 82% Length 3, alignment 0/ 0: 87% Length 3, alignment 0/ 0: 82% Length 4, alignment 0/ 0: 115% Length 4, alignment 0/ 0: 115% Length 4, alignment 0/ 0: 122% Length 5, alignment 0/ 0: 127% Length 5, alignment 0/ 0: 119% Length 5, alignment 0/ 0: 127% Length 6, alignment 0/ 0: 103% Length 6, alignment 0/ 0: 100% Length 6, alignment 0/ 0: 100% Length 7, alignment 0/ 0: 82% Length 7, alignment 0/ 0: 91% Length 7, alignment 0/ 0: 87% Length 8, alignment 0/ 0: 111% Length 8, alignment 0/ 0: 124% Length 8, alignment 0/ 0: 124% Length 9, alignment 0/ 0: 136% Length 9, alignment 0/ 0: 136% Length 9, alignment 0/ 0: 136% Length 10, alignment 0/ 0: 136% Length 10, alignment 0/ 0: 135% Length 10, alignment 0/ 0: 136% Length 11, alignment 0/ 0: 136% Length 11, alignment 0/ 0: 136% Length 11, alignment 0/ 0: 135% Length 12, alignment 0/ 0: 136% Length 12, alignment 0/ 0: 136% Length 12, alignment 0/ 0: 136% Length 13, alignment 0/ 0: 135% Length 13, alignment 0/ 0: 136% Length 13, alignment 0/ 0: 136% Length 14, alignment 0/ 0: 136% Length 14, alignment 0/ 0: 136% Length 14, alignment 0/ 0: 136% Length 15, alignment 0/ 0: 136% Length 15, alignment 0/ 0: 136% Length 15, alignment 0/ 0: 136% Length 4, alignment 0/ 0: 115% Length 4, alignment 0/ 0: 115% Length 4, alignment 0/ 0: 115% Length 32, alignment 0/ 0: 127% Length 32, alignment 7/ 2: 395% Length 32, alignment 0/ 0: 127% Length 32, alignment 0/ 0: 127% Length 8, alignment 0/ 0: 111% Length 8, alignment 0/ 0: 124% Length 8, alignment 0/ 0: 124% Length 64, alignment 0/ 0: 128% Length 64, alignment 6/ 4: 475% Length 64, alignment 0/ 0: 131% Length 64, alignment 0/ 0: 134% Length 16, alignment 0/ 0: 128% Length 16, alignment 0/ 0: 119% Length 16, alignment 0/ 0: 128% Length 128, alignment 0/ 0: 129% Length 128, alignment 5/ 6: 475% Length 128, alignment 0/ 0: 130% Length 128, alignment 0/ 0: 129% Length 32, alignment 0/ 0: 126% Length 32, alignment 0/ 0: 126% Length 32, alignment 0/ 0: 126% Length 256, alignment 0/ 0: 127% Length 256, alignment 4/ 8: 545% Length 256, alignment 0/ 0: 126% Length 256, alignment 0/ 0: 128% Length 64, alignment 0/ 0: 171% Length 64, alignment 0/ 0: 171% Length 64, alignment 0/ 0: 174% Length 512, alignment 0/ 0: 126% Length 512, alignment 3/10: 585% Length 512, alignment 0/ 0: 126% Length 512, alignment 0/ 0: 127% Length 128, alignment 0/ 0: 129% Length 128, alignment 0/ 0: 128% Length 128, alignment 0/ 0: 129% Length 1024, alignment 0/ 0: 125% Length 1024, alignment 2/12: 611% Length 1024, alignment 0/ 0: 126% Length 1024, alignment 0/ 0: 126% Length 256, alignment 0/ 0: 128% Length 256, alignment 0/ 0: 127% Length 256, alignment 0/ 0: 128% Length 2048, alignment 0/ 0: 125% Length 2048, alignment 1/14: 625% Length 2048, alignment 0/ 0: 125% Length 2048, alignment 0/ 0: 125% Length 512, alignment 0/ 0: 126% Length 512, alignment 0/ 0: 127% Length 512, alignment 0/ 0: 127% Length 4096, alignment 0/ 0: 125% Length 4096, alignment 0/16: 125% Length 4096, alignment 0/ 0: 125% Length 4096, alignment 0/ 0: 125% Length 1024, alignment 0/ 0: 126% Length 1024, alignment 0/ 0: 126% Length 1024, alignment 0/ 0: 126% Length 8192, alignment 0/ 0: 125% Length 8192, alignment 63/18: 636% Length 8192, alignment 0/ 0: 125% Length 8192, alignment 0/ 0: 125% Length 16, alignment 1/ 2: 317% Length 16, alignment 1/ 2: 317% Length 16, alignment 1/ 2: 317% Length 32, alignment 2/ 4: 395% Length 32, alignment 2/ 4: 395% Length 32, alignment 2/ 4: 398% Length 64, alignment 3/ 6: 475% Length 64, alignment 3/ 6: 475% Length 64, alignment 3/ 6: 477% Length 128, alignment 4/ 8: 479% Length 128, alignment 4/ 8: 479% Length 128, alignment 4/ 8: 479% Length 256, alignment 5/10: 543% Length 256, alignment 5/10: 539% Length 256, alignment 5/10: 543% Length 512, alignment 6/12: 585% Length 512, alignment 6/12: 585% Length 512, alignment 6/12: 585% Length 1024, alignment 7/14: 611% Length 1024, alignment 7/14: 611% Length 1024, alignment 7/14: 611%