aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
35 hourssys/tree.h: RemovedHEADgithub/mastergithub/mainmastermainJoel Sherrill1-864/+0
This file was from a specific older FreeBSD version. There have been multiple changes to this file with FreeBSD 14 including breaking changes to the file. Including this file as part of newlib results in not always having the correct version of sys/tree.h for any specific software. RTEMS will manage its use of this file outside of newlib.
43 hourslibc/arm: add missing .cfi_sectionsClément Chigot7-0/+7
The modifications added by the series "M-profile PACBTI-enablement" (see 9d6b00511e50a54d2472d11f75f7c0f2b4a98b24) have introduced a couple of .cfi_* instructions. Like for e6459123e497409a9e3d845c39829a9602ba55a4, these instructions create object files which contain .eh_frame sections. However, ARM uses its own unwind info format, not .eh_frame, which is generated by ARM-specific directives, not .cfi_*. The .eh_frame sections are useless, but also not removed by strip and may be harmful with some linker scripts. Adding ".cfi_sections .debug_frame" (as in glibc) moves the generated directives towards .debug_frame instead of .eh_frame. Making them easier to handle. * libc/machine/arm/aeabi_memmove-thumb2.S: Use .cfi_sections .debug_frame. * libc/machine/arm/aeabi_memset-thumb2.S: Likewise. * libc/machine/arm/memchr.S: Likewise. * libc/machine/arm/memcpy-armv7m.S: Likewise. * libc/machine/arm/setjmp.S: Likewise. * libc/machine/arm/strlen-armv7.S: Likewise. * libc/machine/arm/strlen-thumb2-Os.S: Likewise.
44 hourslibc/include/sys/resource.h: Add RUSAGE_THREADJoel Sherrill1-0/+3
2 dayssys: Remove $FreeBSD$: two-line .h patternWarner Losh1-2/+0
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2 daysspdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh1-1/+1
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2 dayssys/stdatomic.h: be nicer to c++Konstantin Belousov1-0/+10
Use of stdatomic.h is undefined in C++, even the C++ 2020 standard does not list stdatomic.h as a C library header supported by the language. More, there are some subtle differences between the <atomic> C++ header, and C11+ stdatomic.h provided features. Nonetheless, it is a quality of the implementation aspect, so let mis-users mis-use stdatomic.h as they want, by making a compat shim for _Bool. PR: 262683 Reported by: yuri Reviewed by: dim, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34686
2 dayssys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni1-0/+2
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
8 dayslibc/include/complex.h: Add CMPLX, CMPLXF, and CMPLXLJoel Sherrill1-0/+13
8 dayslibc/include/sys/_default_fcntl.h: O_RSYNC and O_DSYNC are POSIXJoel Sherrill1-2/+3
These should not be in a Cygewin conditional.
10 daysarm: Fix fma & fmaf implementationsMickaël Thomas2-2/+2
The vfma.f32|64 z, x, y instruction performs the operation z += x * y without intermediate rounding. The register used for z is both read and written by the instruction. The inline assembly must therefore use the "+" constraint modifier.
13 dayslibc: sh: add missing prototypes and change functions from K&R to ANSIPietro Monteiro4-18/+33
The SuperH target doesn't build on GCC 14.1 because of missing function prototypes or because some function declarations use the deprecated K&R style. This patch adds missing prototypes on the files the functions are used and convert K&R declarations to ANSI-style. Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2024-06-26arm: emit .type %function directive in FUNC_START macroChristophe Lyon1-0/+2
The linker needs to know whether a symbol is STT_FUNCTION when deciding which farcall stub to emit (if needed), this patch adds this to the FUNC_START macro which is used in crt0.
2024-06-06newlib: libm: skip "long double" complex functions if long double != doublePietro Monteiro14-6/+47
The rest of "long double" functions aren't compiled with long double and double are not the same. Do the same for all complex functions. Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2024-05-22arc: libc: Record r58/r59 in long-jump's bufferShahab Vahedi2-7/+19
The "longjmp" expects the "setjmp" to save the r58/r59 registers, if there is any. With this change they are saved accordingly. Checked for regression with running GCC's DejaGnu tests: $ runtest execute.exp=pr56982.c dg-torture.exp=pr48542.c Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
2024-05-22arc: libc, libgloss: Remove .file directive from .S filesYuriy Kolerov1-3/+1
Assembler for ARCv2 always extends the name provided by .file directive to an absolute form. On ARCv3 targets .file directive forces assembler to put a provided string to DW_AT_name field as is without extending to an absolute path. Then GDB cannot find source files because of it. The best way to fix this issue is just delete lines with .file directive in .S files and let the compiler to decide what DW_AT_name must contain. Particularly, the compiler fills this filed by an absolute path to a .S file because only absolute paths are used in toolchain's build process. Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22arc: libc: Add support of 16-entry register fileClaudiu Zissulescu28-56/+84
ARC supports a restricted register file with 16 registers. However, optimized routines support only a full register file. Thus, fallback on default implementation in case of 16-entry register file. Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-04-04amdgcn: Implement proper locks: Fix ↵Thomas Schwinge1-0/+4
'newlib/libc/sys/amdgcn/include/sys/lock.h' for C++ As of commit 7dd4eb1db9e1b1b9f14ef5b743705156e5f370e1 "amdgcn: Implement proper locks", we get, by the thousands, for C++ code: In file included from [...]/newlib/libc/include/stdio.h:60, from [...]: [...]/newlib/libc/include/sys/reent.h:911:1: error: expected declaration before '}' token
2024-03-25amdgcn: Implement proper locksAndrew Stubbs4-3/+250
This should prevent printf output from multiple threads getting garbled. I don't know why IO ever worked properly -- probably it was always a bit broken -- but the GFX11 devices have a different cache architecture and trying to print from many threads at once corrupted the FILE buffers.
2024-03-13libc/include/sys/select.h: Use elif not elifdefJoel Sherrill1-1/+1
The cpp directive "elifdef" is only available in very recent GCC versions. This should be able to compile on older toolchains in C99 mode.`
2024-03-13RTEMS: Increase FS_SETSIZE to 256 bitsChris Johns1-0/+2
2024-03-11libc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IOTorbjörn SVENSSON2-471/+471
Regression tested in basepoints/gcc-14-9032-g945cb8490cb with arm-none-eabi. Example failure without this change: $ arm-none-eabi-g++ .../pr100611.C -std=c++20 --specs=nosys.specs -o /dev/null --specs=nano.specs .../ld: .../libc_nano.a(libc_a-svfwprintf.o): in function `_svfwprintf_r': (.text._svfwprintf_r+0xd8): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x834): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x85c): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x8a8): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x8dc): undefined reference to `__ssputws_r' .../ld: .../libc_nano.a(libc_a-svfwprintf.o):(.text._svfwprintf_r+0x900): more undefined references to `__ssputws_r' follow collect2: error: ld returned 1 exit status Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
2024-02-28Cygwin: add compile warning if ENOSHARE or ECASECLASH is usedChristian Franke1-3/+3
These errno values are no longer used by Cygwin. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-02-24RTEMS: Define ssize_t for <dirent.h>Sebastian Huber1-0/+5
This fixes the following build issue: newlib/libc/include/dirent.h:84:1: error: unknown type name 'ssize_t'; did you mean '_ssize_t'? 84 | ssize_t posix_getdents(int, void *, size_t, int); | ^~~~~~~ | _ssize_t
2024-02-21strptime: fix am/pm converting to 24-hour systemAlexey Lapshin1-5/+6
Fix the issue of parsing 08:00AM, which currently gives a 20:00 representation.
2024-02-05getlocalename_l: fix _reent for _REENT_SMALL targetsCorinna Vinschen1-1/+6
The new _MB_CAPABALE-only _misc_reent member getlocalename_l_buf was incorrectly initialized in the _REENT_INIT_MISC macro, so the build failed for _REENT_SMALL targets, independet of the _MB_CAPABALE setting. Fixes: 71511d4ac868 ("getlocalename_l: implement per SUS Base Specifications Issue 8 draft") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: implement setproctitlegithub/topic/3.6topic/3.6Corinna Vinschen1-0/+8
Make sure to create commandline according to setting of setproctitle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31sys/stat.h: drop __INSIDE_CYGWIN__ guardsCorinna Vinschen1-2/+2
These were only necessary until we dropped 32 bit Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Cygwin: posix_getdents: implement per SUS Base Specifications Issue 8 draftCorinna Vinschen1-0/+3
- Basically maintain a hidden DIR* inside fhandlers. - lseek has to be tweaked to allow basic seeking on the directory descriptor. - the current implementation does not keep the dir positions between duplicated descriptor in sync. In fact, every descriptor keeps its own copy of the DIR* and after dup/fork/exec, the directory position is reset to 0, i. e., to the start of the directory, as if rewinddir() has been called on the new descriptors. While this behaviour isn't yet covered by the Issue 8 draft, a bug report along these lines exists and will probably be picked up for TC1. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31getlocalename_l: implement per SUS Base Specifications Issue 8 draftCorinna Vinschen5-0/+116
#include <locale.h> const char *getlocalename_l(int category, locale_t locobj); Most notably, we need a per-thread space to store the string returned if locobj is LC_GLOBAL_LOCALE. No errors are defined for getlocalename_l. So we can't use buffer allocation which might lead to an ENOMEM error. We have to use a "static" buffer in the per-thread state. Note that the feature test macro in locale.h is not quite correct. This needs to be fixed as soon as the Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-31Hide itoa, utoa, __itoa and __utoa in stdlib.h on Cygwin onlycygwin-3.5.0Christian Franke1-1/+3
These functions are non-standard and not exported by Cygwin. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-01-29ssp: add support for _FORTIFY_SOURCE=3Christian Franke4-8/+23
If specified, use __builtin_dynamic_object_size() instead of __builtin_object_size() if supported (GCC 12.0 or later). This enables buffer overflow checks if the buffer size is non-const but known during runtime. Use new macro __ssp_bos_known() instead of the (bos(p) != (size_t)-1) checks. The latter is no longer a compile time constant in all cases. This avoids the generation of unused code. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-01-22newlib: docs: add "Function " to every function nodeMike Frysinger20-436/+436
When creating a split manual with one-node-per-page, the main index.html ends up getting clobbered by the page for the index() function because it uses "@node index" which, for html, also creates an index.html page. To remedy this, add "Function " to every function node so now we output "Function-index.html" and avoid clobbering. It also namespaces every other function and helps make sure we don't clobber anything else. Otherwise, there isn't really much rendering difference as @node text is mostly internal. Node title text comes from @section instead.
2024-01-22newlib: docs: print the function indexMike Frysinger2-0/+11
The generated function documentation makes sure to include entries for every function in the function index via @findex, but then the manuals forget to actually print the index.
2024-01-22Add Dimitar Dimitrov as maintainer for pruJeff Johnston1-0/+1
2024-01-19fputwc: call __fputwc directlyCorinna Vinschen2-2/+7
Avoid another hop in the call stack. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19memccpy: fix pointer assignmentCorinna Vinschen1-2/+2
The local vars dst and src are unsigned pointers, but two assignments cast their value to signed explicitely. This results in the warning "pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Wpointer-sign]" in case of -Wall. Fix the cast. Fixes: d254189b38bb ("2002-07-23 Jeff Johnston <jjohnstn@redhat.com>") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19ORIENT: avoid "expression has no effect" warningCorinna Vinschen3-3/+3
The warning "right-hand operand of comma expression has no effect [-Wunused-value]" crops up with -Wall in cases where ORIENT is called without checking or assigning its value. Explicitely void the expression in these cases to avoid the warning. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19_fputwc_r: actually return result of __fputwcCorinna Vinschen1-1/+1
Compiling with -Wall uncovered a bug in _fputwc_r introduced in commit 09119463a1445 ("stdio: split byte- and wide-char-oriented low-level output functions"). The underlying function __fputwc has been accidentally called without fetching its return value. So the return value of _fputwc_r (and thus fputwc) was undefined. Fixes: 09119463a1445 ("stdio: split byte- and wide-char-oriented low-level output functions" Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-15Cygwin: introduce close_range(2)Christian Franke1-0/+6
This function closes or sets the close-on-exec flag for a specified range of file descriptors. It is available on FreeBSD and Linux. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-01-08fix strverscmp comparison of digit sequence with non-digitsBrian Inglis1-3/+3
From: Rich Felker <dalias@aerifal.cx> Date: Mon, 7 Nov 2022 22:17:55 -0500 the rule that longest digit sequence not beginning with a zero is greater only applies when both sequences being compared are non-degenerate. this is spelled out explicitly in the man page, which may be deemed authoritative for this nonstandard function: "If one or both of these is empty, then return what strcmp(3) would have returned..." we were wrongly treating any sequence of digits not beginning with a zero as greater than a non-digit in the other string. Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
2024-01-02newlib: libc: Improved the readability of strspn with minor optimizationXiao Zeng1-1/+2
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2023-12-31Changes for newlib 4.4.0 snapshotnewlib-4.4.0Jeff Johnston5-17/+29
- bump up version to 4.4.0
2023-12-31Minor improvement to H8 startup codeJeff Law1-18/+12
Basically the startup code needs to clear memory from _edata to _end. In the past it's been done with a fairly naive copy loop. This changes the code to just call memset and let memset figure out a sensible way to handle the operation given the size and alignment requirements. I don't have performance data on this. I cobbled it together some time ago in response to seeing some of the GCC tests with larger .bss sections taking an insane amount of time to just get from _start to main. With the fixes to the H8 decoder in the simulator it may not matter nearly as much anymore. This has been in my tester for months. Naturally it does not cause any regressions in the H8 port.
2023-12-29newlib MMIX: Fix compilation warnings that recent gcc treats as errorsHans-Peter Nilsson10-21/+30
Without this, when building with recent gcc, we'll see errors when compiling for --target mmix the first being: CC libc/sys/mmixware/libc_a-chmod.o In file included from /x/newlib/libc/sys/mmixware/chmod.c:17: /x/newlib/libc/sys/mmixware/chmod.c: In function 'chmod': /x/newlib/libc/sys/mmixware/sys/syscall.h:139:6: error: implicit declaration \ of function 'sprintf' [-Wimplicit-function-declaration] 139 | sprintf (buf, "UNIMPLEMENTED %s in %s\n", __FUNCTION__, __FILE__); \ Other warnings also quelled. * libc/sys/mmixware/sys/syscall.h: Include stdio.h, string.h and unistd.h. * libc/sys/mmixware/_exit.c: Call __unreachable after simulator exit. * libc/sys/mmixware/chown.c (chown): Match declaration in unistd.h. * libc/sys/mmixware/getpid.c (_getpid): Ditto. * libc/sys/mmixware/kill.c (_kill): Ditto. * libc/sys/mmixware/link.c (_link): Ditto. * libc/sys/mmixware/read.c (_read): Ditto. * libc/sys/mmixware/sbrk.c (_sbrk): Ditto. * libc/sys/mmixware/unlink.c (_unlink): Ditto. * libc/sys/mmixware/write.c (_write): Ditto.
2023-12-23GCN: Implement '_exit' instead of 'exit'Thomas Schwinge4-25/+24
... so that all of 'exit', '_exit', '_Exit' work. 'exit' thus becomes the standard 'newlib/libc/stdlib/exit.c'. (Getting 'atexit' functional needs further work elsewhere.) See also commit 5841b2f6a4208682264d03e3edfa0a09881932a6 "nvptx: Implement '_exit' instead of 'exit'".
2023-12-22Fix newlib H8/300 bits for C99/gcc-14Jeff Law1-0/+2
Similar to other patches. This adds a missing prototype and #include to some H8/300 specific code in newlib. Pushed to the trunk given Jeff J's pre-approval for these kinds of changes.
2023-12-21Optimize strpbrk.cJeff Johnston1-9/+2
2023-12-20newlib: Fix long double for unsupported rounding modes and exceptionsCraig Blackmore3-2/+16
RISC-V newlib fails to build for soft float multilibs since long double support was enabled in: commit 04798b7bb69571452d2cfc7e0b052a9bbd3b619d Author: Kito Cheng <kito.cheng@sifive.com> Date: Mon Dec 4 15:41:39 2023 +0800 RISC-V: Support long double math Long double for RISC-V is using 128 bit IEEE 754 format like Aarch64, so we reference AArch64 to support that. The RISC-V soft floating point environment only supports the FE_TONEAREST rounding mode and does not support exceptions. Guard long double rounding and exception support with ifdefs based on the presence of the relevant rounding modes and exceptions. Tested on gcc/g++ testsuite using RISC-V GNU Newlib Toolchain built by riscv-gnu-toolchain with multilibs: riscv-sim/-march=rv32i/-mabi=ilp32/-mcmodel=medlow riscv-sim/-march=rv32iac/-mabi=ilp32/-mcmodel=medlow riscv-sim/-march=rv32im/-mabi=ilp32/-mcmodel=medlow riscv-sim/-march=rv32imac/-mabi=ilp32/-mcmodel=medlow riscv-sim/-march=rv32imafc/-mabi=ilp32f/-mcmodel=medlow riscv-sim/-march=rv64imac/-mabi=lp64/-mcmodel=medlow Co-authored-by: Simon Cook <simon.cook@embecosm.com>
2023-12-19newlib: libc: Improved the readability of strcspn with minor optimizationXiao Zeng1-4/+2
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2023-12-19Fix various v850 problemsJeff Law6-7/+10
These fixes fall into a few different buckets. First c99 doesn't allow a parameter without a type. So in cases where the type had previously been an implicit int, make it an explicit int. Second, for return values, don't allow them to be implicit ints either, make them explicit. In a few cases change c89 function definitions to c99 function definitions. Lastly include <stdlib.h> in sbrk.c to get the prototype for abort () which we call when we detect a heap/stack collision.