711 Commits

Author SHA1 Message Date
Tsz Chan
f5c5f9f926
[libc] Implement getitimer and setitimer, add proxy headers for itimerval (#134773)
#133983
2025-04-14 13:39:42 -07:00
Michael Jones
556fb4c9af
[libc] Disable sin/cospif16 on aarch64 (#134918)
The tests are failing and it's unclear why. Disabling for now until a
fix can be implemented. See
https://github.com/llvm/llvm-project/issues/134917 for details.
2025-04-08 12:42:44 -07:00
Aditya Tejpaul
d33ae41c62
[libc] Implemented utimes (Issue #133953) (#134167)
This pull request implements the `utimes` command in libc ([Issue
#133953](https://github.com/llvm/llvm-project/issues/133953)).

- [x] Add the implementation of `utimes` in `/src/sys/time`.
- [x] Add tests for `utimes` in `/test/src/sys/time`. 
- [x] Add `utimes` to
[entrypoints.txt](https://github.com/llvm/llvm-project/blob/main/libc/config/linux/x86_64/entrypoints.txt)
for at least x86_64 and whatever you're building on
- [x] Add `utimes` to
[include/sys/time.yaml](https://github.com/llvm/llvm-project/blob/main/libc/include/sys/time.yaml)
2025-04-03 16:19:12 -07:00
lntue
8741412bdf
[libc][math] Implement a fast pass for atan2f128 with 1ULP error using DyadicFloat<128>. (#133150)
Part of https://github.com/llvm/llvm-project/issues/131642.
2025-04-01 10:57:32 -04:00
Tejas Vipin
8078665bca
[libc][math][c23] Add hypotf16 function (#131991)
Implement hypot for Float16 along with tests.
2025-03-31 10:06:28 -04:00
Tejas Vipin
d22e35be17
[libc][math][c23] Add asinhf16 function (#131351)
Implement asinh for Float16 along with tests. Closes #131001
2025-03-29 13:54:52 +01:00
Mohamed Emad
4840895467
[libc] implement memalignment (#132493)
This patch adds the `memalignment` function to LLVM-libc, following its
description in [WG14 N3220,
§7.24.2.1](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf#page=387).

- [x] Add the implementation of `memalignment` in
[`/src/stdlib`](https://github.com/llvm/llvm-project/tree/main/libc/src/stdlib)
- [x] Add tests for `memalignment` in
[`/test/src/stdlib`](https://github.com/llvm/llvm-project/tree/main/libc/test/src/stdlib)
- [x] Add `memalignment` to
[`entrypoints.txt`](https://github.com/llvm/llvm-project/blob/main/libc/config/linux/x86_64/entrypoints.txt)
for at least x86_64 and whatever you're building on
- [x] Add `memalignment` to
[`include/stdlib.yaml`](https://github.com/llvm/llvm-project/blob/main/libc/include/stdlib.yaml)




Closes #132300

---------

Co-authored-by: Joseph Huber <huberjn@outlook.com>
2025-03-28 16:07:57 -07:00
Michael Jones
3a5d77608b
[libc] Update headers on aarch64 (#133180)
The entrypoints for aarch64 are mostly up to date, but the headers are
not. This patch fixes that, and also makes explicit the dependency from
OSUtils/linux on sys/syscalls.h
2025-03-27 09:05:24 -07:00
Harrison Hao
ebcf1de065
[libc][math] Disable acoshf16 Test on AArch64 to resolve test failures. (#132580) 2025-03-23 11:19:20 +08:00
Harrison Hao
445837a363
[libc][math][c23] Add fmaf16 C23 math function. (#130757)
Implementation of fmaf16 function for 16-bit inputs.
2025-03-23 10:48:56 +08:00
Harrison Hao
ee3e17d67f
[libc][math][c23] Add acoshf16 C23 math function. (#130588)
Implementation of acoshf16 function for 16-bit inputs.
2025-03-22 22:08:34 -04:00
lntue
a17b03f0e4
[libc][math] Implement fast pass for double precision atan function. (#132333)
Implement fast pass for double precision `atan` using range reduction
modulo 1/64 and degree-9 Taylor polynomial.
Relative error is bounded by 2^-66.
2025-03-21 14:12:06 -04:00
Krishna Pandey
bda87e0a09
[libc][sched] Implement CPU_ZERO, CPU_ISSET, CPU_SET macros (#131524)
This PR implements the following macros for `sched.h`:
- `CPU_ZERO`
- `CPU_ISSET`
- `CPU_SET`

Fixes #124642

---------

Signed-off-by: krishna2803 <kpandey81930@gmail.com>
2025-03-19 13:44:41 -04:00
Connector Switch
af7c8c475a
[libc] Implement search/lsearch (#131431)
ref:
- https://man7.org/linux/man-pages/man3/lsearch.3.html
- https://pubs.opengroup.org/onlinepubs/009696699/functions/lsearch.html
2025-03-19 08:40:59 +08:00
Roland McGrath
460b9cda81
[libc] Disable dl_iterate_phdr entrypoint for linux fullbuild (#131893)
There are some issues with typedef conflicts between libc headers
and Linux kernel headers arising.  Disable building the new code
for Linux for now.
2025-03-18 12:26:22 -07:00
Roland McGrath
123c0040d4
[libc] Define (stub) dl_iterate_phdr (#131436)
This fleshes out the <link.h> a little more, including the
`struct dl_phdr_info` type and declaring the dl_iterate_phdr
function.  There is only a no-op implementation without tests, as
for the existing dlfcn functions.
2025-03-18 11:38:33 -07:00
Connector Switch
ab22f652a4
[libc] implement strings/str{n}casecmp_l (#130407)
ref:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcasecmp_l.html

This patch introduces the `strcasecmp_l` function. At present, the
locale parameter is ignored, making it a stub implementation. This is
consistent with how other locale-related functions, such as `islower_l`,
are treated in our codebase as well as in
[musl](https://github.com/bminor/musl/blob/master/src/string/strcasecmp.c)
and
[bionic](https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/bionic/strings_l.cpp).

---------

Co-authored-by: Michael Jones <michaelrj@google.com>
2025-03-12 10:49:04 +08:00
Connector Switch
a5588b6d20
[libc] implement strings/ffs (#129892)
This patch adds the `strings/ffs` function.
ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/ffs.html
Closes: #122054.
2025-03-08 09:31:18 +08:00
Ajay Raj
9a65dc9513
Add sysexits.h header with BSD exit codes (total-18) (#126112)
This pull request adds a new header file, SysExits.h, to the LLVM
project. The header includes 18 BSD exit code.
2025-03-06 16:25:14 -08:00
Michael Jones
64ae0a102f
[libc] implement l64a (#129099)
Adds l64a, which generates the base 64 string expected by a64l.
2025-02-27 12:48:39 -08:00
Krishna Pandey
f6bfa33cdb
[libc][stdfix] Implement fixed point bitsfx functions in llvm libc (#128413)
Fixes #113359

---------

Signed-off-by: krishna2803 <kpandey81930@gmail.com>
2025-02-27 13:05:27 -05:00
Michael Jones
8beec9fc48
[libc] implement a64l (#128758)
Implement the posix function a64l.
Standard:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/a64l.html
2025-02-25 13:57:13 -08:00
Michael Jones
f4a80180f1
[libc] Move fileno and fdopen to fullbuild only (#128762)
Both fileno and fdopen require interfacing with the opaque FILE struct,
so they shouldn't be enabled in overlay mode. This patch moves both into
fullbuild only on all platforms.

Fixes #128643
2025-02-25 13:56:20 -08:00
wldfngrs
3e284554a8
[libc][math][c23] Add acosf16() function (#127731)
- Implementation of acosf16 (inverse cosine) function for 16-bit inputs.
- Exhaustive tests across the 16-bit input range.
2025-02-23 19:46:46 +01:00
Petr Hosek
00637b7dfb
[libc] Add strftime_l (#127767)
This is a (no-op) locale version of strftime.

Fixes: https://github.com/llvm/llvm-project/issues/106630
2025-02-21 10:50:32 -08:00
Zaky Hermawan
ef49760fa9
[libc][POSIX][unistd] implement getsid (#127341)
Fixes https://github.com/llvm/llvm-project/issues/126603

---------

Signed-off-by: ZakyHermawan <zaky.hermawan9615@gmail.com>
2025-02-19 14:26:18 -08:00
Petr Hosek
a2b4d4e756
Revert "[libc] Add strftime_l" (#127766)
Reverts llvm/llvm-project#127708
2025-02-19 00:39:33 -08:00
Petr Hosek
9072ba71ca
[libc] Add strftime_l (#127708)
This is a (no-op) locale version of strftime.
2025-02-18 23:54:45 -08:00
Michael Jones
398f865499
[libc] Implement strftime (#122556)
Implements the posix-specified strftime conversions for the default
locale, along with comprehensive unit tests. This reuses a lot of design
from printf, as well as the printf writer.

Roughly based on #111305, but with major rewrites.
2025-02-14 15:56:55 -08:00
Krishna Pandey
1f51038036
[libc][stdfix] Implement countlsfx functions in libc. (#126597)
fixes #113357

---------

Signed-off-by: krishna2803 <kpandey81930@gmail.com>
2025-02-12 14:12:44 -05:00
wldfngrs
7ee56b9afc
[libc][math][c23] Add asinf16() function (#124212)
Co-authored-by: OverMighty <its.overmighty@gmail.com>
2025-02-10 12:38:55 +01:00
Joseph Huber
7623d91784 Revert "[libc][stdfix] Fix buildbot failure because of a typo. (#126291)"
This reverts commit bada9220b87e73c0f4a498b82f883e17eda928d1.

Revert "[libc][stdfix] Implement fixed point `countlsfx` functions in llvm-libc (#125356)"

This reverts commit f2a1103b323492160d7d27a1575fbda709b49036.
2025-02-07 14:34:40 -06:00
Krishna Pandey
f2a1103b32
[libc][stdfix] Implement fixed point countlsfx functions in llvm-libc (#125356)
fixes #113357
2025-02-07 13:53:17 -05:00
c8ef
6807164500
[libc] Add the <endian.h> header. (#125168)
Closes [#124631](https://github.com/llvm/llvm-project/issues/124631).
ref:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html

This patch adds the implementation of `endian.h`, which includes the
header itself and three related macros. These macros in the header rely
on the compiler preprocessor, similar to how
https://github.com/llvm/llvm-project/blob/main/libc/src/__support/endian_internal.h
does. Hopefully this will meet the requirements for compiling llvm with
llvm-libc.
2025-02-07 09:20:18 +08:00
Alex Prabhat Bara
74c2e9a82a
[libc] generate sys/wait.h for aarch64 (#125171)
Fixes: #125102
2025-02-06 13:15:45 -08:00
c8ef
e1c63bbde5
[libc] implement sys/uio/readv (#124718)
Closes #124694.

This patch adds the `sys/uio/readv` function.
ref:
https://pubs.opengroup.org/onlinepubs/009696699/functions/readv.html
2025-02-06 09:28:20 +08:00
Nick Desaulniers
72aa3889fb
[libc][poll] remove entrypoint for riscv (#125941)
riscv32 specifically doesn't provide EITHER SYS_poll or SYS_ppoll. We may be
able to reimplement poll in terms of syscalls to SYS_ppoll_time64, but will
leave that as a TODO for the future. (Such as when we want to be able to cross
compile for riscv32).

Link: #125940
Fixes: #125118
2025-02-05 13:56:30 -08:00
Nick Desaulniers
8e35b3d29b
[libc][POSIX][poll.h] implement poll (#125118)
Simple syscall.

Fixes: #124647
2025-02-05 13:24:39 -08:00
Krishna Pandey
6f750cfb96
[libc][unistd] Implement setsid (#125704)
https://man7.org/linux/man-pages/man2/setsid.2.html

closes #124632
2025-02-05 10:08:16 -08:00
Nick Desaulniers
631a6e0004
[libc][wchar] implement wcslen (#124150)
Update string_utils' string_length to work with char* or wchar_t*, so that it
may be reusable when implementing wmemchr, wcspbrk, wcsrchr, wcsstr.

Link: #121183
Link: #124027

Co-authored-by: Nick Desaulniers <ndesaulniers@google.com>

---------

Co-authored-by: Tristan Ross <tristan.ross@midstall.com>
2025-01-23 13:33:04 -08:00
Joseph Huber
db6b7a84e6
[libc][NFC] Strip all training whitespace and missing newlines (#124163) 2025-01-23 12:02:54 -06:00
Schrodinger ZHU Yifan
defd0d966d
[libc] implement unistd/getentropy (#122692)
Implement GNU extension getentropy. This function is used by many
programs to acquire entropy without handling the loop of getrandom.
2025-01-15 18:27:05 +08:00
wldfngrs
ecf4f95c4f
[libc][math][c23] Add tanf16 function (#121018)
- Implementation of tan for 16-bit floating point inputs.
- Exhaustive tests across the 16-bit input range
2025-01-12 23:46:53 -05:00
Schrodinger ZHU Yifan
73dd730fb9
[libc] implement sys/uio/writev (#122233)
implement sys/uio/writev according to POSIX standard. This vectorized IO
API is needed by many logging libraries to achieve atomic logging
multiple strings.
2025-01-10 12:49:00 +08:00
Shourya Goel
9f75b6664f
[libc][complex] fix buildbot errors (#121141)
Fix buildbot errors due to #121140
2024-12-26 12:57:48 +05:30
Shourya Goel
abd9102344
[libc][complex] add cfloat16 and cfloat128 compiler flags (#121140)
Proper fix for the temporary fix in #114696
2024-12-26 12:50:07 +05:30
Shourya Goel
ff97daadcd
Revert "[libc][complex] enable CFP128 entrypoints on X86_64 (#121111)" (#121113)
This reverts commit dd9c5c118230fc9adde668f2c96323b73a677400.
2024-12-25 20:56:13 +05:30
Shourya Goel
dd9c5c1182
[libc][complex] enable CFP128 entrypoints on X86_64 (#121111) 2024-12-25 20:45:32 +05:30
Shourya Goel
c98e79d856
[libc][complex] Implement different flavors of the cproj function (#119722)
Refer section 7.3.9.5 of ISO/IEC 9899:2023
2024-12-18 02:04:50 +05:30
wldfngrs
6a865b6d3d
[libc][math][c23] Add cosf16 function (#118785) 2024-12-15 18:58:54 +01:00