Commit graph

2562 commits

Author SHA1 Message Date
Zorojuro
36b6f48f88
[libc] Add conversion tests between emulated and native f128 (#213422)
Adds conversion tests between emulated and native float128 type, which
would be later used in f128 functions .
2026-08-01 19:36:57 +05:30
Alexey Samsonov
fd7993ea2d
[libc] Add <sys/statfs.h> header and entrypoints. (#213108)
Implement `statfs` and `fstatfs` functions on Linux.

We already have `struct statfs` and syscall wrappers defined (to
implement POSIX `<sys/statvfs.h>`). Use them to provide Linux-specific
functions as well.
2026-07-31 14:29:27 +00:00
Zorojuro
f79a8888eb
[libc] Fix float128-to-integer conversion UB (#211593)
https://github.com/llvm/llvm-project/pull/200565#discussion_r3643991194
Fixes the recent issue pointed out in the above comment
about undefined behavior for float128 in the case of extremely large
values and extremely small values.
2026-07-31 18:28:13 +05:30
hulxv
0879c1092c
[compiler-rt][builtins] libc-backed floating-point extend/trunct builtins (#209984)
Add libc-backed floating-point extend/truncate builtins

Part of #197824
2026-07-31 00:50:13 +00:00
Alexey Samsonov
2e838bf84d
[libc] Fix aligned_alloc used in hermetic tests. (#213041)
Use the provided alignment for the pointer to the returned
memory chunk instead of the size.

This fixes occasional segfaults in `hsearch` tests after
ce62aab97e, since
hash-table bitmask implementation uses SSE2 intrinsics with 16-byte
alignment.
2026-07-30 10:29:38 -07:00
Jeff Bailey
a853e6fcaf
[libc] Add struct passwd type, pwd.yaml, and pwd_utils parser (#212421)
Added struct passwd type definition, pwd.yaml header specification, and
parse_passwd_line utility returning ErrorOr<struct passwd> for
colon-separated
password file parsing with hermetic unit tests.

Note: Additional POSIX pwd.h functions (getpwuid, getpwnam, getpwuid_r,
getpwnam_r, fgetpwent) are omitted from this initial change and will be
added in follow-up PRs.

* Added libc/include/llvm-libc-types/struct_passwd.h and proxy header
* Added libc/include/pwd.yaml header specification
* Added pwd_utils.h and pwd_utils.cpp implementing ErrorOr<struct
passwd> parse_passwd_line
* Added pwd.h to target public headers for linux architectures
* Added unit tests in libc/test/src/pwd/pwd_utils_test.cpp

Assisted-by: Automated tooling, human reviewed.
2026-07-30 15:27:07 +01:00
Pavel Labath
3122acf9f4
[libc] Move test macro implementations out of the Test class (#212783)
This is useful for several reasons:
- it makes it possible to use the macros outside of the test methods,
aligning with googletest. Although this isn't recommended, the
alternatives are often not worth it.
- it makes it possible (with additional changes) to expose this
infrastructure to C_TESTs (which currently use the assert() macro, which
is a no-op in release mode)
- it makes it possible to add (and have assertions in) googletest style
SetUp/TearDownTestSuite functions.

I've converted the main assertion macros for now, to test the waters.
I'm planning to handle EXPECT/ASSERT_THAT and EXPECT/ASSERT_EXIT/DEATH
in a follow-up.
2026-07-30 15:46:44 +02:00
Pavel Labath
cc623d6e99
[libc][test] Add EXPECT_STREQ and ASSERT_STREQ macros for integration tests (#212729)
Add EXPECT_STREQ and ASSERT_STREQ macros to IntegrationTest/test.h using
cpp::string_view. Note that, unlike the unit test macro (but like
googletest), this version treats NULL as distinct from "". The
inconsistency is unfortunate, but I think it's important as the code is
used for testing functions like getenv(), where "" and NULL have very
different meanings.

We should probably follow this up with a change to make the unit test
macro behave the same way.

Update integration tests to use the new macros instead of handrolled
string equality functions (my_streq), strcmp, inline_strcmp, or
string_view wrappers.
2026-07-30 15:46:02 +02:00
Pavel Labath
6e9a51c805
[libc][cmake] Make hermetic tests support FLAGS (#212460)
Currently the tests skip themselves because this gets treated as a
(missing) dependency.

I also enable tests that were explicitly skipped with UNIT_TEST_ONLY.
Some of the FP tests are claiming to be failing on GPUs (in 2023). If
that is still true, I'll skip them with if(TARGET_IS_GPU).
2026-07-30 15:41:20 +02:00
Alexey Samsonov
e7b04c15e6
[libc] Modernize and extend dirent.h header. (#212902)
Extend the `<dirent.h>` header with macro and types specified in recent
POSIX.1-2024:
* Add `posix_dent` structure, which has more fields than `dirent`, that
are actually used in practice. This struct would be identical to
`dirent` that we have on Linux
* Add `reclen_t` type for `d_reclen` field.
* Add macro `DT_BLK` and friends

Also, extend the tests to verify the values of `d_type` field, now that
we have the proper macro defined.

Assisted by: Gemini, human-verified
2026-07-29 17:49:01 -07:00
Jackson Stogel
8d404384dd
[libc][realpath] Follow symlinks (#212164)
This commit updates realpath to call `readlinkat` on symlinks during
path resolution.

Some notes on implementation:
- `PendingPath` uses a `cpp::string` to store unprocessed path
components. This could be more efficient by using a `PATH_MAX` buffer
and storing the path at the end of the buffer, which would allow for
easy prepending. However, using a `cpp::string` avoids the pointer
arithmetic and memory management that would involve.
- This PR implements `cpp::string::replace` to avoid pointer arithmetic
inside `realpath`. This should hopefully not be too inefficient, since
`prepend` reuses space from processed path components there's enough
room, there certainly exist some bad inputs that would cause many
`memmove` operations.
2026-07-29 18:07:03 +00:00
hulxv
a13822ff14
[compiler-rt][builtins] add libc-backed arithmetic builtins (#207092)
Add libc-backed arithmetic builtins 


Depends on #197950

Part of #197824
2026-07-29 00:38:54 +00:00
Jeff Bailey
6d1ace547c
Revert "[libc] Implement cpp::unique_ptr utility" (#212644)
Reverts efe202c769 and
83dfacdbda.

Reverts #212629 and #206701.
2026-07-28 16:28:15 -07:00
Jeff Bailey
83dfacdbda
[libc] Implement cpp::unique_ptr utility (#206701)
[libc] Implement cpp::unique_ptr utility

Implemented cpp::unique_ptr and cpp::default_delete in
libc/src/__support/CPP/unique_ptr.h for internal use within LLVM-libc.

* Added cpp::default_delete and its array specialization.
* Implemented cpp::unique_ptr with support for custom deleters and
  array specialization.
* Applied LIBC_TRIVIAL_ABI to unique_ptr and LIBC_NO_UNIQUE_ADDRESS to
the
  deleter to enable empty member optimization and register-passing ABI.
* Defined portable LIBC_NO_UNIQUE_ADDRESS and LIBC_TRIVIAL_ABI macros in
  attributes.h.
* Included is_assignable.h in type_traits.h to support conversion
  assignment constraints.
* Modernized template constraints using enable_if_t and
is_convertible_v.
* Added comprehensive unit tests in
libc/test/src/__support/CPP/unique_ptr_test.cpp, including coverage for
  reset sequencing, custom deleters, and conversion constructors.

This is a simplified implementation with the following limitations:
* No support for custom pointer types (hardcoded to T*).
* No support for reference deleter types or array conversion.

Adding this to LLVM libc because some things (like regex) require
dynamic
memory allocation, and this will help with correct memory management.

Assisted-by: Automated tooling, human reviewed.
2026-07-28 21:03:40 +01:00
Alexey Samsonov
98fb5dae73
[libc] Fix EOF handling in fscanf (#211982)
`fscanf` family of functions should return EOF if:
- end of input is reached before either the first successful conversion
or a matching failure occurs;
- a read error occurs.

This wasn't handled correctly before - in "system FILE" mode (in overlay
build) `EOF` return value from `getc` was passed through to parser,
violating `Reader` interface, which triggered infinite loops on
"while-not-EOF" `fscanf` loops. In llvm-libc-FILE mode `fscanf` simply
returned zero instead of EOF, because the code only checked error
indicator on a stream.

This PR removes _any_ lookups of eof/error indicators on an input stream
- instead we can simply rely on the `getc` (system or internal) function
behavior, which returns `EOF` on unsuccessful reads.

Extend the test cases for `fscanf` to cover various return values in
cases when `EOF` is reached (before or after conversions / matching
errors).
2026-07-28 08:27:07 -07:00
Jeff Bailey
e362f3c846
[libc][stdlib] Add putenv (#208339)
Added the POSIX putenv() function and its internal support.

Implemented EnvironmentManager::put() to insert caller-provided
"name=value" strings directly into the environment array, managing
ownership correctly (caller retains ownership).

Registered for x86_64, aarch64, and riscv. Integration tests cover basic
operations, ownership semantics, validation, and edge cases.

Assisted-by: Automated tooling, human reviewed.
2026-07-28 15:35:04 +01:00
Pavel Labath
f11d740e20
[libc] Make hash_test hermetic (#212428)
Aligned allocation is now supported, but the test burns through our 1MB
never-freeing bump pointer allocation buffer. I tweak the test to reuse
the buffer between loop iterations, reducing its memory usage by about
300x :P.
2026-07-28 14:11:16 +02:00
Pavel Labath
2d7aaf670d
[libc] Fix path collisions between unit and hermetic tests (#212425)
Use the APPEND_LIBC_TEST macro to ensure each test gets a unique path to
operate on. Enable the affected tests in hermetic mode.
2026-07-28 11:04:03 +02:00
Pavel Labath
0bcff14b17
[libc] Make <sys/mman.h> tests hermetic (#210697)
The only issue was in pkey_test, which uses function-local static to do
lazy initialization. This requires the c++ runtime
(__cxa_guard_acquire/release).

There are no threads in this test, so we can just use the
(non-thread-safe) hand-rolled version of that. This is currently our
only test with such a pattern.

This would be something that in gtest would go into a SetUpTestSuite
method, but our test framework currently doesn't have an equivalent.
2026-07-28 09:58:31 +02:00
Pavel Labath
7bc2770064
[libc] Make assert_test hermetic (#210700)
Call our own close() instead of the system one.
2026-07-28 09:25:31 +02:00
Pavel Labath
ce62aab97e
[libc] Add aligned_alloc and delete[] to hermetic tests (#210693)
This lets us run (at least) <search.h> tests in hermetic mode.
2026-07-28 08:57:05 +02:00
Pavel Labath
f2c7e2bcd5
[libc] Fix atexit_test in hermetic mode (#210656)
We never unlocked the ThreadAtExit mutex, which meant the second call to
exit deadlocked. This was detected in the unit tests as they were
calling __cxa_thread_atexit from the system C library.
2026-07-28 08:20:07 +02:00
Alex Strelnikov
39d3b9344f
[libc] Add stub implementation for strptime. (#211088)
This PR adds a stub for `strptime` under
`LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS` for x86_64 and aarch64 as a
first step in implementing the function.
2026-07-27 16:19:21 +01:00
Jeff Bailey
99a8141b11
[libc][test][NFC] Fix compiler warnings in libc tests (#212100)
Resolved compiler warnings in several libc unit and integration tests:

- Fixed -Wmissing-designated-field-initializers in localtime_r_test.cpp
by using zero-initialisation instead of partial designated initialisers.
- Fixed -Wimplicit-int-conversion in sigaltstack_test.cpp by explicitly
casting the loop index to uint8_t.
- Fixed -Wunused-parameter in pthread_barrier_test.cpp by omitting
unused parameter names in function definitions.

Assisted-by: Automated tooling, human reviewed.
2026-07-26 22:03:05 +01:00
Jackson Stogel
a81db64570
[libc][cpp::string] Allocate fewer temp strings in operator= and += (#210895)
This PR generally updates `cpp::string` to avoid incidental allocations.
Specifically, it:

- Updates `opreator=(string_view)` to avoid allocating a temporary
string:
67ebc4b221/libc/src/__support/CPP/string.h (L106-L108)
- Changes `operator+=(const string&)` to accept a `string_view` so that
strings may be appended without allocation.
- Makes the `string(string_view)` constructor explicit. Before, there
were non-obvious allocations because of the implicit conversion.

As a side effect, this PR has to more carefully handle self-assignment
and self-append. This PR updates append and assignment to avoid calling
`realloc` during append / assignment, as this may invalidate input
pointers held by `string_view` if they point to data held by the string.
This also fixes self-assignment, which previously didn't work, eg
`cpp::string s = "abc"; s = s;` would zero out `s`.
2026-07-26 07:25:50 -07:00
Jeff Bailey
653e7b05bb
[libc][test][NFC] Fix pthread_setschedparam_test flakiness (#212067)
Synchronised child thread execution in pthread_setschedparam_test using
a mutex lock. This prevents race conditions where the child thread
exited before scheduling parameter assertions ran on multi-core
platforms such as aarch64.

Added missing pthread target dependencies to CMakeLists.txt.

Assisted-by: Automated tooling, human reviewed.
2026-07-26 08:47:50 +01:00
Jackson Stogel
921f7ca6be
[libc][cpp::string] Do not count null terminator in capacity() (#211918)
Currently, `capacity()` includes the null terminator of the backing
buffer, which does not align with C++20's `std::string`. That is,
`s.reserve(s.capacity())` should be a no-op. While there's no
requirement these be in-sync, it is less surprising to align its
behavior.

Also, this fixes the case where `reserve()` is called on an empty
string, where previously the null terminator was not set.
2026-07-24 15:59:21 -07:00
lntue
995e2af535
[libc][termios] Make termios hermetic and fix its compatibility with glibc 2.42 or after. (#211039)
Make termios hermetic and address its compatibility with glibc 2.42
breaking change
with baud rate definitions:

https://inbox.sourceware.org/libc-announce/5906001.DvuYhMxLoT@pinacolada/T/

Fixes include:
- Baud rate translation utilities.
- Add proxy headers for termios.h macros and types.
- Update tests.

Assisted-by: Gemini 3.5 Flash.
2026-07-24 13:31:41 -04:00
Pavel Labath
35368cb5dd
[libc] Convert readv, writev, and read_write tests to use pipes (#210725)
Using a pipe avoids races between "hermetic" and "unit" versions of the
same test and avoids leaving filesystem artifacts around if the test
fails. If I'm successful, we won't have the worry about the first
problem anymore, but I think it's still a nice cleanup.

Assisted by Gemini.
2026-07-24 10:34:52 +02:00
Pavel Labath
7623cd8c6e
[libc] Make getauxval test hermetic (#210706)
To make this work, I needed to remove the getauxval definition from
HermeticTestUtils.cpp‎. Even though it was weak, it still prevented the
real one from being used because the linker will not extract an archive
member if the dependency has already been satisfied by a weak
definition.

I *think* I've removed the need for it by changing how the getauxval
dependency is declared in cmake (it fixes the errors on the presubmit
aarch64 bot), but I don't know if that was the only issue.
2026-07-24 09:41:53 +02:00
Pavel Labath
ee407f7e70
Reapply "[libc] Port process utilities to hermetic mode and enable some tests" (#211484)
This reverts https://github.com/llvm/llvm-project/pull/210889
(b7f642fdb2,
"Revert
recent changes to the hermetic tests"), re-applying
https://github.com/llvm/llvm-project/pull/209999

(9e2e9b33e1,
"[libc] Port process
utilities to hermetic mode and enable some tests") and
https://github.com/llvm/llvm-project/pull/210715

(4bd1a447e1,
"[libc] Make hermetic test
syscall deps linux-only"), which was reverted due to failures on the GPU
bots.

There are a couple of small changes w.r.t the original patches:
- This version disables the exit tests on builds that do not
  support subprocess tests (via the newly introduced
  LIBC_TEST_SUBPROCESS_TESTS). This is necessary because the GPU builds
  contain the relevant entry points, which means their tests are not
  skipped automatically.
- fix a typo in a variable name
- make the dependencies conditional on LIBC_TEST_SUBPROCESS_TESTS
  instead of listing the target OSs directly. This is a no-op, as that's
  exactly how the variable is defined, but it makes the code cleaner.
2026-07-24 08:53:10 +02:00
Jeff Bailey
8d4f2368a0
[libc] Implement pthread_setschedparam and getschedparam (#205770)
Implemented the pthread_setschedparam and pthread_getschedparam
functions.

Added Linux syscall wrappers:
* sched_setscheduler
* sched_getscheduler
* sched_getparam

Updated the Thread class to support getting and setting scheduling
parameters.

Added integration tests to verify the implementation.

Assisted-by: Automated tooling, human reviewed.
2026-07-23 17:59:56 +01:00
Michael Jones
66d6316c9f
[libc] Fix missed errno deps for integration tests (#211415)
Fullbuild testing pulls in LLVM-libc's errno, which needs to be linked
explicitly.
2026-07-23 08:56:24 -07:00
Pavel Labath
585c900260
[libc][cmake] Add LIBC_TEST_SUBPROCESS_TESTS (#211238)
This replaces the ENABLE_SUBPROCESS_TESTS preprocessor flag with a cmake
variable. By lifting the logic into cmake, we select which test
framework files to build, and also exclude whole tests, if they do not
make sense without subprocess support.

This enables us to fix failures from (now reverted) #209999 and
 #210889, as it will let us skip the *exit family of tests. The problem
there was that GPU targets support the *exit entry points (so the
auto-skipping logic does not kick in), but they do not have (and maybe
cannot have?) the functionality necessary to test them.

I convert two libgen tests (the only users of ENABLE_SUBPROCESS_TESTS)
to the new framework.
2026-07-23 06:53:19 +02:00
lntue
4e833e21cc
[libc] Add missing functions in FEnvImpl.h under LIBC_MATH_USE_SYSTEM_FENV config. (#211303) 2026-07-22 14:44:54 -04:00
Alex Strelnikov
c3373183d2
[libc] Migrate printf_core from stdio/ to __support/. (#208303)
The code will be updated and used for wide character printf functions
implemented in wchar/, so __support/ is a more consistent shared
location.

Assisted-by: Automated tooling, human reviewed.
2026-07-21 14:35:24 -07:00
Zorojuro
7c445ab1d0
[libc] Float128 Emulation in LLVM libc (#200565)
Introducing emulated float128 in LLVM libc
2026-07-21 18:50:26 +05:30
Pavel Labath
b7f642fdb2
[ilbc] Revert recent changes to the hermetic tests (#210889)
PR #209999 (9e2e9b33e1) "broke" the GPU
build by causing many/most tests to not run.

The follow-up in #210715 (4bd1a447e1)
broke it for real
(https://lab.llvm.org/buildbot/#/builders/10/builds/32254) by causing
too many tests to run.

I think we just need to disable the extra tests, but I want to start out
by reverting both patches so that it's easier to compare the
before/after state in the next attempt.
2026-07-21 09:47:25 +02:00
Pavel Labath
375231d8ea
[libc] Add struct group_req, struct group_source_req, and related socket options (#210029)
Add definitions for struct group_req and struct group_source_req in
llvm-libc-types and wire them into <netinet/in.h>.

Also define the multicast socket options using these structs:
- MCAST_JOIN_GROUP
- MCAST_LEAVE_GROUP
- MCAST_BLOCK_SOURCE
- MCAST_UNBLOCK_SOURCE
- MCAST_JOIN_SOURCE_GROUP
- MCAST_LEAVE_SOURCE_GROUP

Add layout assertions for struct group_req and struct group_source_req
to the netinet/in.h unit test.

Assisted by Gemini.
2026-07-21 07:19:01 +02:00
Jackson Stogel
66af87fd8b
[libc][realpath] Validate path components (#209370)
This PR updates `realpath` to validate paths and return `ENOTDIR` or
`ENOENT` according to
https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html.
2026-07-20 14:54:37 -07:00
Pavel Labath
c84d20b180
[libc] Fix sockatmark test (#210655)
When writing the test, I assumed that (linux) domain sockets do not
support OOB data, and that sockatmark returns 0, because it can never
read it.

In fact, as of 2021, linux does support OOB on domain sockets, but this
feature can be turned off at build time (CONFIG_AF_UNIX_OOB). In this
case (or in the case of older kernels), the kernel returns an error (and
the test fails).

Armed with this knowledge, I modify the test to test both "1" (OOB
present) and "0" (no OOB data) cases by actually sending OOB data into
the socket. I use the send call to determine the presence of OOB
support, and have the test skip itself if it is absent. OOB data only
makes sense on stream sockets, so change the socketpair type to that.

---------

Co-authored-by: Jeff Bailey <jbailey@raspberryginger.com>
2026-07-20 15:44:10 +00:00
Pavel Labath
9e2e9b33e1
[libc] Port process utilities to hermetic mode and enable some tests (#209999)
This is achieved by calling internal libc functions in hermetic mode. In
the overlay mode I keep calling the system functions so that the tests
work even on systems which don't have these implemented.

I also needed to implement the delete operators as both the libc proper
and the test framework uses them nowadays.

This is sufficient to enable all stdlib tests in hermetic mode, except
for one, which actually exposes a bug in the implementation. I'll deal
with that in a separate patch.
2026-07-20 09:46:00 +02:00
Anonmiraj
f05a649741
[libc][math] Implement half precision lgamma function (#192834)
The implementation uses three distinct paths based on $|x|$:

- Small ($|x| < 0.66$): Fits a degree-12 Chebyshev for $h(t) =
\frac{\text{lgamma}(t) + \log(t)}{t}$, recovering $\text{lgamma}(t) = t
\cdot h - \log(t)$.

- Medium ($|x| \in [0.66, 3.37]$): Fits a degree-20 Chebyshev for $g(t)
= \frac{\text{lgamma}(t)}{(t-1)(t-2)}$
- Stirling ($|x| > 3.37$): Uses $(x-0.5) \cdot \log(x) - x +
\frac{\log(2\pi)}{2}$ plus 1/2/4/8-term Bernoulli corrections by
sub-range.


Special cases: NaN, +/-Inf -> +Inf, +/-0 pole, negative integer pole,
lgamma(1) = lgamma(2) = 0 exactly, overflow for large positive x.

Exhaustive tests pass in all 4 rounding modes.

-- CORE-MATH reciprocal throughput --
Ntrial = 20 ; Min = 391.348 + 77.447 clc/call; Median-Min = 68.093
clc/call; Max = 540.055 clc/call;
-- System LIBC reciprocal throughput --
Ntrial = 20 ; Min = 377.829 + 81.686 clc/call; Median-Min = 64.851
clc/call; Max = 532.888 clc/call;
2026-07-19 04:29:50 +03:00
Pengxiang Huang
2926d18a06
[libc][semaphore] Add post and wait operations for internal semaphore (#198959)
This pr implements https://github.com/llvm/llvm-project/issues/190847,
adding the post and wait operations in posix semaphore for linux using
futex.

Particularly, 
`sem_post`:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_post.html
`sem_trywait`, `sem_wait`:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_wait.html
`sem_timedwait`, `sem_clockwait`:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_clockwait.html#

The implementation is assisted by Claude Code Opus 4.7, specifically for
the unit tests generations.
2026-07-17 15:19:10 -07:00
Jackson Stogel
b4a444ad63
[libc][realpath] Support relative paths (#209374)
Updates realpath to call the `getcwd` linux syscall wrapper to resolve
cwd-relative queries.
2026-07-17 14:51:04 -07:00
Jackson Stogel
3e55f3c56e
[libc][realpath][test] Create test files/directories (#209369)
Follow-up PRs will add path validation etc to `realpath`, which will
require paths to exist in the filesystem.

This PR bumps the memory limit in `HermeticTestUtils.cpp`. The realpath
unit tests allocate quite a few strings, and since memory in hermetic
tests is never freed, the unit test quickly reaches the limit.
2026-07-17 12:12:15 -07:00
Pavel Labath
c571b0bd73
[libc] Fix size of struct sockaddr_storage (#210037)
My cleverness with the union backfired as it introduced an
(architecture-specific) padding between before it. Drop the union to
avoid that.

This probably wouldn't break much as the structure exists just to
allocate space (and this made it larger), but we should fix it
nonetheless.
2026-07-17 08:45:51 +02:00
Pavel Labath
c5837b469c
[libc][bazel] Add remaining sys/socket functions and tests (#209798)
This patch adds the following sys/socket functions and syscall wrapper
libraries to BUILD.bazel:
- accept
- accept4
- bind
- connect
- getpeername
- getsockname
- listen
- sockatmark

I'm also enabling the unit tests for these functions. Running AF_UNIX
socket tests under Bazel ran into a problem where the absolute path to
the test sandbox directory exceeds the 108-byte limit of
sockaddr_un::sun_path. To work around that, I added a TestDirectoryScope
helper that temporarily chdirs into the test directory so the tests can
use short relative filenames, and restores the original working
directory on exit.

Assisted by Gemini.
2026-07-17 07:54:19 +02:00
sohail
7fec267c9a
[libc][stdfix] Guard DiviFxTest shift edge cases against narrow IntType (#209970)
Fixes riscv32 buildbot failure from #206115.
2026-07-17 07:10:29 +05:30
lntue
a45ae4cf77
[libc][math] Fix double-rounding errors with denormal inputs for hypot function. (#208247)
The issue was reported by Paul Zimmermann.

Solution: for denormal inputs, we use 1.0 + x trick after proper scaling
to mimick rounding at denormal scale.
2026-07-16 20:11:26 -04:00