summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
* Regenerate lib/posix/Makefile.inJeff Johnston2021-03-051-3/+16
|
* RISC-V: Fix optimized strcmp on big endianMarcus Comstedt2021-02-251-4/+36
|
* Set __IEEE_BIG_ENDIAN for big endian RISC-VMarcus Comstedt2021-02-251-0/+4
|
* Include malloc.h in libc/stdlib/aligned_alloc.cHans-Peter Nilsson2021-02-181-0/+1
| | | | | | | | | | | | | Without this, for a bare-iron/simulator target such as cris-elf, you'll see, at newlib build time: /x/gccobj/./gcc/xgcc -B/x/gccobj/./gcc/ <many options elided> -c -o lib_a-aligned_alloc.o \ `test -f 'aligned_alloc.c' || echo '/y/newlib/libc/stdlib/'`aligned_alloc.c /y/newlib/libc/stdlib/aligned_alloc.c: In function 'aligned_alloc': /y/newlib/libc/stdlib/aligned_alloc.c:35:10: warning: implicit declaration of function \ '_memalign_r' [-Wimplicit-function-declaration] 35 | return _memalign_r (_REENT, align, size); | ^~~~~~~~~~~
* Complete revert of 2019-08-19, st_atime in libc/include/sys/stat.hHans-Peter Nilsson2021-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The revert-part of the revert-and-fix commit, b99887c4283f a.k.a. "Revert previous change to sys/stat.h and fix cris libgloss", apparently intending to revert f75aa6785151 a.k.a. "Fix regression in cris-elf caused by sys/stat.h change" and fix it in another way, wasn't complete. Although the fix-part added the prerequisite "#undef st_atime" (et al) to gensyscalls, the revert-part didn't revert the "&& !defined(__cris__)" in sys/stat.h, stopping st_atime (et al) from being defined. The effect of the unreverted change is that accessing the struct stat compatibility member names "st_atime" (et al) as in "struct stat mystat; mystat.st_atime;" yields errors, observable for example when building libgfortran in gcc: /x/gcc/libgfortran/intrinsics/stat.c:114:42: error: 'struct stat' has \ no member named 'st_atime'; did you mean 'st_atim'? 114 | sarray->base_addr[8 * stride] = sb.st_atime; | ^~~~~~~~ | st_atim (etc.) Trivially fixed by completing the reversion, removing the "&& !defined(__cris__)" in sys/stat.h. Beware: the net effect of the earlier related change to struct stat in sys/stat.h, leading up to the fix, *does* change its definition as a type. Thankfully, replacing members like "time_t st_atime; long st_spare1;" by "struct timespec st_atim;", ditto st_mtim and st_ctim, is layout-compatible. To wit, that change is "binary compatible". Incidentally, related to the simulator / Linux ABI, there's a transitional stage (see gensyscalls), reloading between "struct stat" (sys/stat.h) and "struct new_stat" (kernel/simulator) as necessary. Tested by a cris-elf gcc build (including libgfortran).
* FTW Port for NewlibEshan dhawan2021-02-094-1/+254
| | | | Signed-off-by: Eshan Dhawan <eshandhawan51@gmail.com>
* Removed Soft float from MIPSEshan dhawan2021-02-052-41/+18
| | | | | | | | | | | This Patch removes Soft Float code from MIPS. Instead It adds the soft float code from RISCV The code came from FreeBSD and assumes the FreeBSD softfp implementation not the one with GCC. That was an overlooked and fixed in the other fenv code already. Signed-off-by: Eshan Dhawan <eshandhawan51@gmail.com>
* Align *utime*() with POSIX/glibcSebastian Huber2021-01-263-6/+6
| | | | | | | Change the prototypes to be in line with POSIX/glibc. This may fix issues with new warnings produced by GCC 11. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Add <poll.h> and <sys/poll.h>Sebastian Huber2021-01-052-0/+107
| | | | | | | Add the POSIX header file <poll.h> which is used by the GCC 11 Ada runtime support. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Bump up newlib version to 4.1.0newlib-4.1.0Jeff Johnston2020-12-18115-1134/+1140
|
* fixes to make compilation succeedsPaul Zimmermann2020-12-182-1/+2
|
* Update gamma functions from code in picolibcJeff Johnston2020-12-174-28/+47
| | | | - fixes issue with inf sign when x is -0
* Add declarations for __ieee754_tgamma functions to fdlibm.hJeff Johnston2020-12-161-0/+2
|
* arm: Fix memchr() for Armv8-RSebastian Huber2020-12-141-0/+4
| | | | | | | | The Cortex-R52 processor is an Armv8-R processor with a NEON unit. This fix prevents conflicting architecture profiles A/R errors issued by the linker. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Fix error in powf for x close to 1 and large yFabian Schriever2020-12-111-1/+1
| | | | | | | | | | | This patch fixes the error found by Paul Zimmermann (see https://homepages.loria.fr/PZimmermann/papers/#accuracy) regarding x close to 1 and rather large y (specifically he found the case powf(0x1.ffffeep-1,-0x1.000002p+27) which returns +Inf instead of the correct value). We found 2 more values for x which show the same faulty behaviour, and all 3 are fixed with this patch. We have tested all combinations for x in [+1.fffdfp-1, +1.00020p+0] and y in [-1.000007p+27, -1.000002p+27] and [1.000002p+27,1.000007p+27].
* Bump newlib release to 4.0.0Jeff Johnston2020-12-11115-1136/+1151
|
* RISC-V: Add machine-specific implementation for lrint[f], lround[f], ↵Kito Cheng2020-11-1810-3/+503
| | | | llrint[f] and llround[f].
* RISC-V: Add machine-specific implementation for isnan[f] and copysign[f]Kito Cheng2020-11-186-3/+237
|
* RISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and ↵Kito Cheng2020-11-182-3/+33
| | | | sf_isinf.c
* malloc/nano-malloc: correctly check for out-of-bounds allocation reqsCorinna Vinschen2020-11-172-2/+27
| | | | | | | | | | | | The overflow check in mEMALIGn erroneously checks for INT_MAX, albeit the input parameter is size_t. Fix this to check for __SIZE_MAX__ instead. Also, it misses to check the req against adding the alignment before calling mALLOc. While at it, add out-of-bounds checks to pvALLOc, nano_memalign, nano_valloc, and Cygwin's (unused) dlpvalloc. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix return type of __locale_ctype_ptr_l()Sebastian Huber2020-11-161-1/+1
| | | | | | | This prevents warnings like this: ctype.h:118:9: warning: return discards 'const' qualifier from pointer target type
* libc/include/newlib.h: Fix C++ compilation issueJoel Sherrill2020-11-161-2/+2
|
* Fix 32-bit integer overflow when calculating TZ rulesIvan Grokhotov2020-11-041-1/+1
|
* RISC-V: Fix wrong including file in s_isinf.cKito Cheng2020-10-291-1/+1
|
* RISC-V: NaN should return 0 for finite[f]Kito Cheng2020-10-292-2/+2
|
* libc/sys/rtems/include/machine/_types.h: Define daddr_t to be 64 bits for RTEMSJoel Sherrill2020-10-281-0/+3
| | | | | This type needs to be able to represent a position on a disk or file system.
* RISC-V: Implment finite and fpclassifyKito Cheng2020-10-279-3/+421
|
* RISC-V: Add fabs[f], fmax[f] and fmin[f].Kito Cheng2020-10-278-3/+345
|
* Define RB_SET_PARENT to do all assignmentsdougm2020-10-261-30/+28
| | | | | | | | | | | | | | | to rb parent pointers. Define RB_SWAP_CHILD to replace the child of a parent with its twin, and use it in 4 places. Use RB_SET in rb_link_node to remove the only linuxkpi reference to color, and then drop color- and parent-related definitions that are defined and used only in rbtree.h. This is intended to be entirely cosmetic, with no impact on program behavior, and leave RB_PARENT and RB_SET_PARENT as the only ways to read and write rb parent pointers. Reviewed by: markj, kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D25264
* In concluding RB_REMOVE_COLOR, in the case whendougm2020-10-261-15/+11
| | | | | | | | | | | | the sibling of the root of the too-short tree is black and at least one of the children of that sibling is red, either one or two rotations finish the rebalancing. In the case when both of the children are red, the current implementation uses two rotations where only one is necessary. This change removes that extra rotation, and in that case also removes a needless black-to-red-to-black recoloring. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25335
* Linuxkpi uses the rb-tree structuresdougm2020-10-261-148/+137
| | | | | | | | | without using their interfaces, making them break when the representation changes. Revert changes that eliminated the color field from rb-trees, leaving everything as it was before. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25250
* Fixup r361997 by balancing parens. Duh.dougm2020-10-261-1/+1
|
* Restore an RB_COLOR macro, for the benefit ofdougm2020-10-261-0/+6
| | | | | | | | a bit of DIAGNOSTIC code that depends on it. Reported by: rpokala, mjguzik Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25204
* To reduce the size of an rb_node, drop the colordougm2020-10-261-138/+143
| | | | | | | | | | | | | | field. Set the least significant bit in the pointer to the node from its parent to indicate that the node is red. Have the tree rotation macros leave the old-parent/new-child node red and the new-parent/old-child node black. This change makes RB_LEFT and RB_RIGHT no longer assignable, and RB_COLOR no longer defined. Any code that modifies the tree or examines a node color would have to be modified after this change. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D25105
* Remove from RB_REMOVE_COLOR some null checksdougm2020-10-261-26/+20
| | | | | | | | | where the pointer checked is provably never null. Restructure the surrounding code just enough to make the non-nullness obvious. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D25089
* RB_REMOVE invokes RB_REMOVE_COLOR either whendougm2020-10-261-72/+65
| | | | | | | | | | | | | | | | | child is red or child is null. In the first case, RB_REMOVE_COLOR just changes the child to black and returns. With this change, RB_REMOVE handles that case, and drops the child argument to RB_REMOVE_COLOR, since that value is always null. RB_REMOVE_COLOR is changed to remove a couple of unneeded tests, and to eliminate some deep indentation. RB_ISRED is defined to combine a null check with a test for redness, to replace that combination in several places. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D25032
* For the case when RB_REMOVE requires a nontrivialdougm2020-10-261-28/+24
| | | | | | | | | | | | search to find the node to replace the one being removed, restructure to first remove the replacement node and correct the parent pointers around it, and then let the all-cases code at the end deal with the parent of the deleted node, making it point to the replacement node. This removes one or two conditional branches. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D24845
* Correct the use of RB_AUGMENT in the RB_TREEdougm2020-10-261-50/+38
| | | | | | | | | | | | | macros so that is invoked at the root of every subtree that changes in an insert or delete, and only once, and ordered from the bottom of the tree to the top. For intel_gas.c, the only user of RB_AUGMENT I can find, change the augmenting routine so that it does not climb from entry to tree root on every call, and remove a 'tree correcting' function that can be supplanted by proper tree augmentation. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D23189
* Add RB_REINSERT(3), a low overhead alternative totrasz2020-10-261-2/+24
| | | | | | | | | | | | removing a node and reinserting it back with an updated key. This is one of dependencies for the upcoming stats(3) code. Reviewed by: cem Obtained from: Netflix MFC after: 2 weeks Sponsored by: Klara Inc, Netflix Differential Revision: https://reviews.freebsd.org/D21786
* amd64: prevent KCSan false positives on LAPIC mappingjah2020-10-261-0/+2
| | | | | | | | | | | | | | | | | | | For configurations without x2APIC support (guests, older hardware), the global LAPIC MMIO mapping will trigger false-positive KCSan reports as it will appear that multiple CPUs are concurrently reading and writing the same address. This isn't actually true, as the underlying physical access will be performed on the local CPU's APIC. Additionally, because LAPIC access can happen during event timer configuration, the resulting KCSan printf can produce a panic due to attempted recursion on event timer resources. Add a __nosanitizethread preprocessor define to prevent the compiler from inserting TSan hooks, and apply it to the x86 LAPIC accessors. PR: 249149 Reported by: gbe Reviewed by: andrew, kib Tested by: gbe Differential Revision: https://reviews.freebsd.org/D26354
* sys: clean up empty lines in .c and .h filesmjg2020-10-261-1/+0
|
* gcc: quiet Wattribute for no_sanitize("address")rlibby2020-10-261-2/+6
| | | | | | | | | | | | This is an unfortunate instance where the __has_attribute check does not function usefully. Gcc does have the attribute, but for gcc it only applies to functions, not variables, and trying to apply it to a variable generates Wattribute. So far we only apply the attribute to variables. Only enable the attribute for clang, for now. Reviewed by: Anton Rang <rang at acm.org> Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22875
* Don't sanitize linker_setdab2020-10-261-0/+7
| | | | | | | | | | | | | The assumptions of linker_set don't play nicely with AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around globals (including those in named sections), whereas linker_set assumes they are all packed consecutively like a pointer array. So: let's annotate linker_set so that AddressSanitizer ignores it. Submitted by: Matthew Bryan <matthew.bryan@isilon.com> Reviewed by: kib, rang_acm.org Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22239
* Make the system C11 atomics headers fully compatible with external GCC.jhb2020-10-262-15/+12
| | | | | | | | | | | | | | | | | | | | The <sys/cdefs.h> and <stdatomic.h> headers already included support for C11 atomics via intrinsincs in modern versions of GCC, but these versions tried to "hide" atomic variables inside a wrapper structure. This wrapper is not compatible with GCC's internal <stdatomic.h> header, so that if GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11 atomics would fail to compile. Fix this by not hiding atomic variables in a structure for modern versions of GCC. The headers already avoid using a wrapper structure on clang. Note that this wrapper was only used if C11 was not enabled (e.g. via -std=c99), so this also fixes compile failures if a modern version of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead of GCC's <stdatomic.h> and this change fixes that case as well. Reported by: Mark Millard Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D16585
* libc/time: Move internal newlib tz-structs into own headerTorbjörn SVENSSON via Newlib2020-10-155-57/+25
| | | | | | | | | | | | | | As discussed in GCC bug 97088 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in prototypes of library functions should use reserved names, or no name at all. This patch moves the internal struct __tzrule_struct to its own internal header sys/_tz_structs.h. This is included from newlib's time code as well as from Cygwin's localtime wrapper. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* drop ambiguous-wide behaviour from Unicode CJK localesThomas Wolff2020-10-131-13/+5
|
* libc/include/wchar.h: Remove parameter nameTorbjörn SVENSSON2020-10-021-2/+2
| | | | | | | | | | | | | | | | | As discussed in GCC bug 97088 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in prototypes of library functions should use reserved names, or no name at all. This patch removes the 'ptr' parameter name from wint_t _getwchar_r (struct _reent *); wint_t _getwchar_unlocked_r (struct _reent *); to avoid possible clashes with user code in case someone uses before including Newlib's wchar.h (or uses some other conflicting definition) Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
* libc/include/inttypes.h: Remove parameter nameTorbjörn SVENSSON2020-10-021-1/+1
| | | | | | | | | | | | | | | | As discussed in GCC bug 97088 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in prototypes of library functions should use reserved names, or no name at all. This patch removes the 'j' parameter name from extern intmax_t imaxabs(intmax_t); to avoid possible clashes with user code in case someone uses before including Newlib's inttypes.h (or uses some other conflicting definition) Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
* libc/include/math.h: Remove parameter nameChristophe Lyon2020-09-251-8/+8
| | | | | | | | | | | | | | | | | | | | | As discussed in GCC bug 97088 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in prototypes of library functions should use reserved names, or no name at all. This patch removes the 'x' parameter name from extern int __isinff (float); extern int __isinfd (double); extern int __isnanf (float); extern int __isnand (double); extern int __fpclassifyf (float); extern int __fpclassifyd (double); extern int __signbitf (float); extern int __signbitd (double); to avoid possible clashes with user code in case someone uses before including Newlib's math.h (or uses some other conflicting definition)
* Port of C-SKY for newlibJojo R2020-09-2311-2/+6360
| | | | | | | | | Contributor list:   - Lifang Xia <lifang_xia@c-sky.com>   - Jojo R <jiejie_rong@c-sky.com>   - Xianmiao Qu <xianmiao_qu@c-sky.com>   - Yunhai Shang <yunhai_shang@c-sky.com>