summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
...
* Add _POSIX_SHARED_MEMORY_OBJECTSGedare Bloom2017-01-131-1/+1
|
* Expand comments on padding used by nano_mallocJoe Seymour2017-01-131-14/+37
| | | | | | | | | | | | | | This patch adds further comments to nano-mallocr.c, to more comprehensively explain how padding works in the malloc_chunk structure. It was originally discussed in the following thread: https://sourceware.org/ml/newlib/2017/msg00031.html 2017-01-13 Joe Seymour <joe.s@somniumtech.com> newlib/ * libc/stdlib/nano-mallocr.c (malloc_chunk, get_chunk_from_ptr) (nano_malloc): Add comments.
* Fix sys/reent.h to remove use of DEBUG flag.Jeff Johnston2017-01-101-2/+2
| | | | | | | | - use of DEBUG flag is non-standard and interferes with other project's using same flag - change to be _REENT_CHECK_DEBUG which means the flag is allowing debugging of _REENT_CHECK macros - use #ifdef instead of #if
* Fix versions in documentation (manually for now)Corinna Vinschen2017-01-092-4/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add pthread_setname_np() and pthread_getname_np()Sebastian Huber2017-01-091-0/+6
| | | | | | | The pthread_setname_np() and pthread_getname_np() are GNU extensions and provided by glibc. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix incorrect cast in nano mallocJoe Seymour2017-01-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in nano-mallocr.c, chunks of heap are represented in memory as a size (of type long), followed by some optional padding containing a negative offset to size, followed by the data area. get_chunk_from_ptr is responsible for taking a pointer to the data area (as returned by malloc) and finding the start of the chunk. It does this by assuming there is no padding and trying to read the size, if the size is negative then it uses that as an offset to find the true size. Crucially, it reads the padding area as a long. nano_malloc is responsible for populating the optional padding area. It does so by casting a pointer to an (int *) and writing the negative offset into it. This means that padding is being written as an int but read as a long. On msp430 an int is 2 bytes, while a long is 4 bytes. This means that 2 bytes are written to the padding, but 4 bytes are read from it: it has only been partially initialised. nano_malloc is the default malloc implementation for msp430. This patch changes the cast from (int *) to (long *). The change to nano_malloc has has been observed to fix a TI Energia project that had been malfunctioning because malloc was returning invalid addresses. The change to nano_memalign is based entirely on code inspection. I've built and tested as follows: Configured (gcc+newlib) with: --target=msp430-elf --enable-languages=c gcc testsuite variations: msp430-sim/-mcpu=msp430 msp430-sim/-mcpu=msp430x msp430-sim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either msp430-sim/-mhwmult=none msp430-sim/-mhwmult=f5series My testing has shown no regressions, however I don't know if the gcc testsuite provides sufficient coverage for this patch? I don't have write access, so if this patch is acceptable after review, I would appreciate it if someone would commit it for me. Thanks, 2017-01-XX Joe Seymour <joe.s@somniumtech.com> newlib/ * libc/stdlib/nano-mallocr.c (nano_malloc): Fix incorrect cast. (nano_memalign): Likewise.
* RTEMS: Add user-defined name to thread queuesSebastian Huber2017-01-091-1/+65
| | | | | | | | Add a user-defined name to the self-contained synchronization objects in order to make system diagnostics, tracing and debugging more user friendly. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Bump release to 2.5.0 for yearly snapshot.newlib-2_5_0Jeff Johnston2016-12-22111-1154/+1123
|
* This is an attempt to fix the problem described here:Jeff Johnston2016-12-224-23/+122
| | | | | | | | | | | | | | | | | | | | | | | | https://sourceware.org/ml/newlib/2016/msg01139.html https://gcc.gnu.org/ml/gcc/2016-12/msg00010.html There is no change if libtool is used. Some run-time support libraries provided by GCC (e.g. libgomp) use configure checks to detect certain features, e.g. availability of thread-local storage. The configure script generates a test program and tries to compile and link it. It should use target libraries and startfiles of the build tree if available and not random ones from the installation prefix for this procedure. The search directories specified by -B are a bit special, see for_each_path() in gcc.c of the GCC sources. First a search is performed on all search paths with the multilib directory appended (if desired), then a second search is performed on demand with the base directory only. For each multilib there is a "newlib" subdirectory. This directory is specified by a -B option for the support libraries. In order to find the newlib artifacts (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib subdirectory withing the build directory. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Increase SEM_VALUE_MAXSebastian Huber2016-12-201-1/+1
| | | | | | | RTEMS defined SEM_VALUE_MAX to 32767 unlike other systems like FreeBSD and glibc. A common value is INT_MAX. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Remove extraneous float casts in wcstod.c.Corinna Vinschen2016-12-161-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove extraneous float casts in strtod.c.Jeff Johnston2016-12-161-2/+2
|
* 2016-12-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>cygwin-2_6_1-releaseJeff Johnston2016-12-152-8/+29
| | | | | | | | * libc/stdlib/strtod.c (strtof_l): Set errno to ERANGE when double to float conversion results in infinity. (strtof): Likewise. * libc/stdlib/wcstod.c (wcstof_l): Likewise. (wcstof): Likewise.
* 2016-12-15 Giuseppe Musumeci <giuseppe.musumeci@broadcom.com>Jeff Johnston2016-12-151-2/+2
| | | | | | | | | | | | | | __sinit initialises some common file descriptors as line buffered and relies on the first users of such FDs to call __smakebuf_r. If __smakebuf_r realises there's no space for a buffer (malloc returns NULL), it makes them unbuffered. However, while setting the __SNBF bit, it doesn't clear the __SLBF bit in the flags. Depending on the order in which functions check buffering flags in the FD, sometime they assume it's line buffered (e.g. __sfvwrite_r), trashing application memory that's not really been allocated to them. This patch solves the problem by clearing the unbuffered/line buffered flag when setting the line buffered/unbuffered flag.
* Big-endian fix for memcpy-armv7m.SJulian Brown2016-12-121-0/+8
| | | | | | | | In the case of memcpy-armv7m.S being built for a big-endian multilib (including armv7 without a specific profile), realignment code made assumptions about the byte ordering being little-endian. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix 'make man' for parallel makeJon Turney2016-12-065-0/+16
| | | | | | | | Ensure the Python Lex/Yacc (PLY) cache used by makedocbook is initialized before it is used by parallelizable rules to make the DocBook XML, as it appears that these can collide in cache generation, leading to errors. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Add <devctl.h> per POSIX 1003.26-2003Joel Sherrill2016-12-053-0/+55
|
* Add missing crt0 symbols for RTEMSSebastian Huber2016-12-051-0/+5
| | | | | | | In order to enable proper detection of thread-local storage availability we have to provide some symbols on ARM. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Enforce no arguments for __get_current_locale/__get_C_localeCorinna Vinschen2016-11-281-2/+2
| | | | | | Remember: foo() != foo(void) Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Correct argument to __get_current_locale.Douglas2016-11-281-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Self-contained pthread_spinlock_t for RTEMSSebastian Huber2016-11-241-1/+5
| | | | | | | | | | | | | | | | | | | | Turn pthread_spinlock_t into a self-contained object. On uni-processor configurations, interrupts are disabled in the lock/trylock operations and the previous interrupt status is restored in the corresponding unlock operations. On SMP configurations, a ticket lock is a acquired and released in addition. See also: https://devel.rtems.org/ticket/2674 This implementation is simple and efficient. However, this test case of the Linux Test Project would fail due to call of printf() and sleep() during spin lock ownership: https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide <memory.h>Sebastian Huber2016-11-221-0/+4
| | | | | | | | Provide <memory.h> for all standard Newlib targets and remove Cygwin-specific header. Most POSIX like systems provide this historic header. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Declare non-standard pthread_yield()Sebastian Huber2016-11-221-0/+4
| | | | | | | The non-standard pthread_yield() function is available at least on Cygwin, FreeBSD and glibc. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Move pthread types to <sys/_pthreadtypes.h>Sebastian Huber2016-11-174-230/+449
| | | | | | | | | | This makes it possible provide operating system specific types for <pthread.h>. It is in line with the FreeBSD header file structure and allows a future cleanup of <pthread.h> to not expose unrelated things via <sys/types.h> and <unistd.h>. Glibc uses the similar <bits/pthreadtypes.h> for this purpose. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add _TICKET_LOCK_INITIALIZER to <sys/lock.h>Sebastian Huber2016-11-171-1/+3
| | | | | | | | Add _TICKET_LOCK_INITIALIZER to statically initialize a _Ticket_lock_Control structure. This makes it possible to embed a ticket lock in other structures outside of <sys/lock.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Use __inline in <sys/lock.h> for RTEMSSebastian Huber2016-11-171-10/+10
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* sys/cdefs.h: Define __hidden as empty on CygwinCorinna Vinschen2016-11-081-0/+5
| | | | | | | Non-default visibility attributes are unsupported on PE/COFF, so don't use in __hidden definition for Cygwin. Add comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Use external header file for kernel space timeSebastian Huber2016-11-071-144/+4
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add kernel space header for <sys/lock.h> for RTEMSSebastian Huber2016-11-071-1/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Use external header file for kernel space typesSebastian Huber2016-11-072-7/+5
| | | | | | | The FreeBSD kernel types are not used in Newlib. Provide them via an external header file to decouple Newlib and FreeBSD updates for RTEMS. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide cap_ioctl_t for RTEMSSebastian Huber2016-11-071-0/+5
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix pdf build failure with texinfo 6.1.0Thomas Preudhomme2016-10-252-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi, make pdf on Ubuntu 16.04 fail with: newlib/libc/libc.texinfo:9: Missing @endcsname inserted. After a lot of fiddling the reason appears to be the combination of concept and function index despite a lack of concept index entries. Arguably texinfo should not error in that case but here we are, newlib will fail to build its documentation on some systems because of this. Since libc.texinfo only contains function index entries this patch simply removes the combination of indices. It does the same for libm.texinfo which has concept index entries but no function index entries. Tested by running make pdf, make dvi, make info and make html successfully. libc.pdf appears to have only one index as expected. == Proposed commit message == Fix pdf build failure with texinfo 6.1.0 as provided in Ubuntu 16.04. Index combination in libc.texinfo and libm.texinfo fails because both file have only one type of index entries. Removing index combination is thus harmless and solves the problem. Is this ok for master? Best regards, Thomas
* Provide vm_page_t for RTEMS via <machine/_types.h>Sebastian Huber2016-10-251-0/+1
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide rman_res_t for RTEMS via <machine/types.h>Sebastian Huber2016-10-251-0/+2
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Provide __intmax_t and __uintmax_tSebastian Huber2016-10-254-33/+40
| | | | | | | | Provide __intmax_t and __uintmax_t via <machine/_default_types.h> and define intmax_t and uintmax_t in <sys/_stdint.h> for FreeBSD compatibility. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix typo in <sys/_stdint.h>Sebastian Huber2016-10-251-1/+1
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* towupper: Eliminate dead codeCorinna Vinschen2016-10-221-3/+0
| | | | | | Fixes Coverity CID 59865 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix a potential buffer overflow in wscanf familyCorinna Vinschen2016-10-221-6/+8
| | | | | | Fixes Coverity CID 60046 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* get_alt_digits: Fix typo in allocationCorinna Vinschen2016-10-221-1/+1
| | | | | | | | adi->digit is an array of CHAR *, not of CHAR **. Fixes Coverity CID 60043 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Actually return value from __cp_indexCorinna Vinschen2016-10-222-4/+1
| | | | | | | | Fixes Coverty CID 153470 Also drop redundant declaration of __cp_index. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Drop redundant checks for NULL input string in wctomb helper funcsCorinna Vinschen2016-10-221-6/+0
| | | | | | Fixes Coverity CIDs 153465 and 153466 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix check for empty locale string in newlocaleCorinna Vinschen2016-10-221-2/+5
| | | | | | | | | | | | | | | The original test is broken. It tests for a NULL locale which isn't just wrong, it simply can't occur at this point due to an earlier check for a NULL locale string. Thus, the locale info for a category is never taken from the environment. Fixes Coverty CID 153467. Also, add comment. Also, add some parens for readability. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add _PC_CASE_INSENSITIVE to [f]pathconfKen Brown2016-10-211-0/+1
| | | | | | | | Update the getconf utility to support the new flag as well as _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY. These were previously unsupported, probably as an oversight. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Make ctype_.c and ctype_.h agree on _ctype_b typeThomas Preud'homme2016-10-171-0/+4
| | | | | | | | _ctype_b is defined in ctype_.c as a const char array for non cygwin targets allowing negative ctype index but as a char array for the same targets in ctype_.h, giving type conflict at compile time. This is because the cygwin targets are not treated specially in the latter file. This patch adds the necessary logic for cygwin targets in ctype_.h.
* Fix typo in strerror doccygwin-2_6_0-releaseCorinna Vinschen2016-08-311-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix off_t typedef on Cygwin64Yaakov Selkowitz2016-08-291-1/+1
| | | | | | | | | | While both long and long long are 64-bits on x86_64, they are distinct types, and long was used prior to commit 477463a2011ba81907a753df9ce7a71b6563db54. Changing this breaks the linking of previously compiled C++ functions with off_t arguments on 64-bit Cygwin with newly compiled code, as the mangling of long (l) and long long (x) differ. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Change return type from locale_t to struct __locale_t * as wellCorinna Vinschen2016-08-251-3/+4
| | | | | | Complements commit 14228e2. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Drop duplicate _ctype_ declaration from ctype_.hCorinna Vinschen2016-08-252-2/+2
| | | | | | It's already defined in ctype.h. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Drop global __ctype_ptr__ entirely in favor of using locale_t::ctype_ptrCorinna Vinschen2016-08-253-37/+33
| | | | | | | | | | Keep __ctype_ptr__ available on Cygwin only, for backward compatibility with existing apps referencing it via the ctype macros. Otherwise initialize __global_locale.ctype_ptr and __C_locale.ctype_ptr and use them throughout. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Use struct __locale_t * for reentrent locale functionsCorinna Vinschen2016-08-251-4/+4
| | | | | | | This fixes a build problem since locale_t is only defined if __POSIX_VISIBLE >= 200809. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>