aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
2021-04-07fenv: fix up stub file comment, drop symlinks from descriptiongithub/topic/shared_arch_headerstopic/shared_arch_headersDavid Macek1-10/+10
also slightly fixed up formatting
2021-04-07Cygwin: don't export _feinitialise from newlibCorinna Vinschen2-11/+1
Use the more official fesetenv(FE_DFL_ENV) from _dll_crt0, thus allowing to drop the _feinitialise declaration from fenv.h. Provide a no-op _feinitialise in Cygwin as exportable symbol for really old applications when _feinitialise was called from mainCRTStartup in crt0.o. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-07fenv: drop Cygwin-specific implementation in favor of newlib codeCorinna Vinschen2-2/+16
Drop the Cygwin-specific fenv.cc and fenv.h file and use the equivalent newlib functionality now, so we have at least one example of a user for this new mechanism. fenv.c: allow _feinitialise to be called from Cygwin startup code fenv.h: add declarations for fegetprec and fesetprec for Cygwin only. Fix a comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-07fenv: move shared x86 fenv.c to libm/machine/shared_x86Corinna Vinschen3-473/+480
Include this file from both sharing architectures, i386 and x86_64. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-07fenv: Move shared x86 sys/fenv.h from x86_64 to shared_x86Corinna Vinschen2-1/+0
drop matching symlink in i386 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-07fenv: add missing declarations to x86 fenv.hCorinna Vinschen1-0/+5
feenableexcept, fedisableexcept and fegetexcept were accidentally missing in the x86 fenv.h Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-07configure.host: define shared ix86 and x86_64 directoryCorinna Vinschen1-4/+4
Add a directory libc/machine/shared_x86 to share header files between ix86 and x86_64 architectures. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-07Add build mechanism to share common header files between machinesCorinna Vinschen38-9/+124
So far the build mechanism in newlib only allowed to either define machine-specific headers, or headers shared between all machines. In some cases, architectures are sufficiently alike to share header files between them, but not with other architectures. A good example is ix86 vs. x86_64, which share certain traits with each other, but not with other architectures. Introduce a new configure variable called "shared_machine_dir". This dir can then be used for headers shared between architectures. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-03-05Regenerate lib/posix/Makefile.inJeff Johnston1-3/+16
2021-02-25RISC-V: Fix optimized strcmp on big endianMarcus Comstedt1-4/+36
2021-02-25Set __IEEE_BIG_ENDIAN for big endian RISC-VMarcus Comstedt1-0/+4
2021-02-18Include malloc.h in libc/stdlib/aligned_alloc.cHans-Peter Nilsson1-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); | ^~~~~~~~~~~
2021-02-16Complete revert of 2019-08-19, st_atime in libc/include/sys/stat.hHans-Peter Nilsson1-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).
2021-02-09FTW Port for NewlibEshan dhawan4-1/+254
Signed-off-by: Eshan Dhawan <eshandhawan51@gmail.com>
2021-02-05Removed Soft float from MIPSEshan dhawan2-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>
2021-01-26Align *utime*() with POSIX/glibcSebastian Huber3-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>
2021-01-05RTEMS: Add <poll.h> and <sys/poll.h>Sebastian Huber2-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>
2020-12-18Bump up newlib version to 4.1.0newlib-4.1.0Jeff Johnston115-1134/+1140
2020-12-18fixes to make compilation succeedsPaul Zimmermann2-1/+2
2020-12-17Update gamma functions from code in picolibcJeff Johnston4-28/+47
- fixes issue with inf sign when x is -0
2020-12-16Add declarations for __ieee754_tgamma functions to fdlibm.hJeff Johnston1-0/+2
2020-12-14arm: Fix memchr() for Armv8-RSebastian Huber1-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>
2020-12-11Fix error in powf for x close to 1 and large yFabian Schriever1-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].
2020-12-11Bump newlib release to 4.0.0Jeff Johnston115-1136/+1151
2020-11-18RISC-V: Add machine-specific implementation for lrint[f], lround[f], ↵Kito Cheng10-3/+503
llrint[f] and llround[f].
2020-11-18RISC-V: Add machine-specific implementation for isnan[f] and copysign[f]Kito Cheng6-3/+237
2020-11-18RISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and ↵Kito Cheng2-3/+33
sf_isinf.c
2020-11-17malloc/nano-malloc: correctly check for out-of-bounds allocation reqsCorinna Vinschen2-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>
2020-11-16Fix return type of __locale_ctype_ptr_l()Sebastian Huber1-1/+1
This prevents warnings like this: ctype.h:118:9: warning: return discards 'const' qualifier from pointer target type
2020-11-16libc/include/newlib.h: Fix C++ compilation issueJoel Sherrill1-2/+2
2020-11-04Fix 32-bit integer overflow when calculating TZ rulesIvan Grokhotov1-1/+1
2020-10-29RISC-V: Fix wrong including file in s_isinf.cKito Cheng1-1/+1
2020-10-29RISC-V: NaN should return 0 for finite[f]Kito Cheng2-2/+2
2020-10-28libc/sys/rtems/include/machine/_types.h: Define daddr_t to be 64 bits for RTEMSJoel Sherrill1-0/+3
This type needs to be able to represent a position on a disk or file system.
2020-10-27RISC-V: Implment finite and fpclassifyKito Cheng9-3/+421
2020-10-27RISC-V: Add fabs[f], fmax[f] and fmin[f].Kito Cheng8-3/+345
2020-10-26Define RB_SET_PARENT to do all assignmentsdougm1-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
2020-10-26In concluding RB_REMOVE_COLOR, in the case whendougm1-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
2020-10-26Linuxkpi uses the rb-tree structuresdougm1-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
2020-10-26Fixup r361997 by balancing parens. Duh.dougm1-1/+1
2020-10-26Restore an RB_COLOR macro, for the benefit ofdougm1-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
2020-10-26To reduce the size of an rb_node, drop the colordougm1-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
2020-10-26Remove from RB_REMOVE_COLOR some null checksdougm1-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
2020-10-26RB_REMOVE invokes RB_REMOVE_COLOR either whendougm1-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
2020-10-26For the case when RB_REMOVE requires a nontrivialdougm1-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
2020-10-26Correct the use of RB_AUGMENT in the RB_TREEdougm1-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
2020-10-26Add RB_REINSERT(3), a low overhead alternative totrasz1-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
2020-10-26amd64: prevent KCSan false positives on LAPIC mappingjah1-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
2020-10-26sys: clean up empty lines in .c and .h filesmjg1-1/+0
2020-10-26gcc: quiet Wattribute for no_sanitize("address")rlibby1-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