[libc-commits] [libc] [llvm] [libc] Clean up libc_errno implementation, dependencies, and add __errno_location alias (PR #235421)
via libc-commits
libc-commits at lists.llvm.org
Sun Oct 25 20:29:31 PDT 2026
https://github.com/lntue updated https://github.com/llvm/llvm-project/pull/235421
>From a55e25d590fff06f6aa4f62ffad2c59d87fbf9db Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Sun, 25 Oct 2026 10:59:02 +0000
Subject: [PATCH 1/2] [libc] Clean up libc_errno implementation, dependencies,
and add __errno_location alias
- Inline `Errno::operator=(int)`, `Errno::operator int()`, and
`Errno::operator&()` in `libc/src/__support/libc_errno.h` and replace
`extern Errno libc_errno;` with `LIBC_INLINE_VAR constexpr Errno libc_errno{}`
so `libc/src/errno/libc_errno.cpp` only defines the backing storage
(`thread_errno` / `shared_errno`) and `__llvm_libc_errno()`.
- Add `LIBC_COPT_PROVIDE_GNU_ALIASES` (enabled by default on Linux) to provide
`__errno_location` as a C symbol alias of `__llvm_libc_errno` via
`LLVM_LIBC_ADD_FUNCTION_C_ALIAS`, declare `__errno_location` in
`libc/include/errno.h.def`, and remove the manual `__errno_location` shim
from `HermeticTestUtils.cpp`.
- Fix `LIBC_ERRNO_MODE` resolution in `libc/shared/libc_common.h` and
`libc/src/__support/libc_errno.h` when `-DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT`
is passed on the compiler command line.
- Clean up stale `libc.src.errno.errno` dependencies in `libc/src/__support/`
(replacing with `libc.hdr.errno_macros` or `libc.src.__support.libc_errno`)
and split the header-only `syscall` target out of `linux_util` (`osutil`).
- Link `libc.src.errno.errno` automatically in `_get_libc_test_dependencies`,
`add_libc_fuzzer`, and `perf_test`, and enable `libc.test.src.errno.errno_test`
in overlay mode.
- Add developer documentation in `libc/docs/dev/errno.md` and update
`libc/docs/dev/code_style.md`.
Assisted-by: Gemini
---
.../modules/LLVMLibCCompileOptionRules.cmake | 4 +
libc/cmake/modules/LLVMLibCTestRules.cmake | 7 +-
libc/config/config.json | 4 +
libc/config/linux/config.json | 5 +
libc/docs/dev/code_style.md | 62 ++--
libc/docs/dev/errno.md | 191 ++++++++++++
libc/docs/dev/index.md | 1 +
libc/include/errno.h.def | 1 +
libc/shared/libc_common.h | 10 +-
libc/src/__support/CMakeLists.txt | 1 +
libc/src/__support/FPUtil/CMakeLists.txt | 7 +-
.../__support/FPUtil/ManipulationFunctions.h | 1 +
.../FPUtil/NearestIntegerOperations.h | 1 +
libc/src/__support/File/linux/CMakeLists.txt | 3 +-
libc/src/__support/File/linux/file.cpp | 2 +-
.../src/__support/OSUtil/linux/CMakeLists.txt | 18 +-
.../linux/syscall_wrappers/CMakeLists.txt | 275 +++++++++---------
.../StringUtil/tables/CMakeLists.txt | 4 +-
.../tables/linux_extension_errors.h | 2 +-
libc/src/__support/libc_errno.h | 23 +-
libc/src/__support/math/CMakeLists.txt | 10 +-
libc/src/__support/math/cos.h | 1 +
libc/src/__support/math/exp10m1f.h | 2 +-
libc/src/__support/math/exp2m1f.h | 2 +-
libc/src/__support/math/expm1.h | 1 +
libc/src/__support/math/expm1f.h | 1 +
libc/src/__support/math/sin.h | 1 +
libc/src/__support/printf_core/CMakeLists.txt | 1 +
.../__support/threads/linux/CMakeLists.txt | 1 -
libc/src/__support/threads/linux/thread.cpp | 1 -
libc/src/errno/libc_errno.cpp | 32 +-
libc/test/UnitTest/HermeticTestUtils.cpp | 3 -
libc/test/src/errno/CMakeLists.txt | 2 +-
libc/test/src/errno/errno_test.cpp | 5 +
.../math/performance_testing/CMakeLists.txt | 1 +
.../llvm-project-overlay/libc/BUILD.bazel | 1 +
36 files changed, 459 insertions(+), 228 deletions(-)
create mode 100644 libc/docs/dev/errno.md
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index b26c1957880a5f..dec75057333fd8 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -210,6 +210,10 @@ function(_get_compile_options_from_config output_var)
list(APPEND config_options "-DLIBC_COPT_SCANF_PROVIDE_ISOC99_ALIASES")
endif()
+ if(LIBC_COPT_PROVIDE_GNU_ALIASES)
+ libc_add_definition(config_options "LIBC_COPT_PROVIDE_GNU_ALIASES")
+ endif()
+
set(${output_var} ${config_options} PARENT_SCOPE)
endfunction()
_get_compile_options_from_config(LIBC_COMPILE_OPTIONS_FROM_CONFIG)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index e9cd18ad076048..25aa8187a207e5 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -413,6 +413,7 @@ endfunction()
# needed to support code coverage profiling in hermetic/full-build mode.
function(_get_libc_coverage_dependencies output_var)
set(${output_var}
+ libc.src.errno.errno
libc.src.stdio.fclose
libc.src.stdio.fdopen
libc.src.stdio.feof
@@ -459,6 +460,7 @@ endfunction()
# entrypoints, subprocess support, and coverage dependencies.
function(_get_libc_test_dependencies output_var user_depends startup_target_dep is_c_test is_fp_test is_integration_test)
get_fq_deps_list(fq_deps_list ${user_depends})
+ list(APPEND fq_deps_list libc.src.errno.errno)
if(is_integration_test)
list(APPEND fq_deps_list
generate-libc-headers
@@ -815,8 +817,7 @@ function(create_libc_test fq_target_name)
)
target_include_directories(${fq_build_target_name} SYSTEM PRIVATE ${LIBC_INCLUDE_DIR})
- target_include_directories(${fq_build_target_name} PRIVATE ${LIBC_SOURCE_DIR})
- target_include_directories(${fq_build_target_name} PRIVATE ${LIBC_BUILD_DIR})
+ target_include_directories(${fq_build_target_name} PRIVATE ${LIBC_SOURCE_DIR} ${LIBC_BUILD_DIR})
_get_common_test_compile_options(compile_options "${TEST_C_TEST}" "${TEST_FLAGS}")
target_compile_options(${fq_build_target_name} PRIVATE ${compile_options} ${TEST_COMPILE_OPTIONS})
@@ -909,7 +910,7 @@ function(add_libc_fuzzer target_name)
get_fq_target_name(${target_name} fq_target_name)
- get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS})
+ get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS} libc.src.errno.errno)
get_object_files_for_test(
link_object_files skipped_entrypoints_list ${fq_deps_list})
if(skipped_entrypoints_list)
diff --git a/libc/config/config.json b/libc/config/config.json
index 604b03c9b5688a..d58002a84330f1 100644
--- a/libc/config/config.json
+++ b/libc/config/config.json
@@ -175,6 +175,10 @@
"LIBC_ADD_NULL_CHECKS": {
"value": true,
"doc": "Add nullptr checks in the library's implementations to some functions for which passing nullptr is undefined behavior."
+ },
+ "LIBC_COPT_PROVIDE_GNU_ALIASES": {
+ "value": false,
+ "doc": "Provide GNU/glibc compatibility symbol aliases (such as __errno_location)."
}
},
"wctype": {
diff --git a/libc/config/linux/config.json b/libc/config/linux/config.json
index 260ec3b43f72c3..bc27cfd1b9e0e5 100644
--- a/libc/config/linux/config.json
+++ b/libc/config/linux/config.json
@@ -1,4 +1,9 @@
{
+ "general": {
+ "LIBC_COPT_PROVIDE_GNU_ALIASES": {
+ "value": true
+ }
+ },
"scanf": {
"LIBC_CONF_SCANF_PROVIDE_ISOC99_ALIASES": {
"value": "${LLVM_LIBC_OVERLAY}"
diff --git a/libc/docs/dev/code_style.md b/libc/docs/dev/code_style.md
index bfc13f0d0be2ee..e0bd8e6fb975a3 100644
--- a/libc/docs/dev/code_style.md
+++ b/libc/docs/dev/code_style.md
@@ -98,17 +98,20 @@ the system libc is affected. When a libc function that can potentially affect
affected. If the global `errno` is affected, then the operation of the unit
test infrastructure itself can be affected.
-To handle `errno` correctly across all build modes and avoid silent thread-local
-storage mismatches, the following rules must be followed:
+For a complete architectural overview of `errno` modes (`LIBC_ERRNO_MODE`),
+targets, and build rules, see {doc}`errno`. To handle `errno` correctly across
+all build modes and avoid silent thread-local storage mismatches, the following
+rules must be followed:
1. **Header Inclusion:**
- Runtime code and unit tests must **ONLY** `#include "src/__support/libc_errno.h"`
- and refer to `libc_errno`.
+ Runtime code and unit tests that read or write `errno` must **ONLY**
+ `#include "src/__support/libc_errno.h"` and refer to `libc_errno`.
- Never `#include <errno.h>`.
- Never `#include "src/errno/libc_errno.h"` (this is a legacy path; the header
lives in `src/__support/`).
- - For standard error constants (such as `EINVAL`, `ENOMEM`), include
- `"hdr/errno_macros.h"`.
+ - If a file only needs standard error constants (such as `EINVAL`, `ENOMEM`)
+ and does not read or write `libc_errno`, include `"hdr/errno_macros.h"`
+ instead.
Setting `errno` should be done directly via `libc_errno`:
@@ -126,35 +129,38 @@ storage mismatches, the following rules must be followed:
to return error values.
3. **CMake Dependencies for Public Entrypoints:**
- Any entrypoint that reads or sets `errno` should ideally declare **BOTH** of the
- following in the `DEPENDS` list of its `add_entrypoint_object`:
- - **`libc.src.__support.libc_errno`**: Satisfies the header dependency for
- `src/__support/libc_errno.h`.
- - **`libc.src.errno.errno`**: Satisfies the link-time requirement for the compiled
- runtime storage (`libc_errno.cpp`) defining `thread_errno`, `__llvm_libc_errno()`,
- and the C++ `Errno` class.
+ - Entrypoints that only use error macros (for example, `pthread_*` functions
+ returning `EINVAL` directly) should depend on **`libc.hdr.errno_macros`**.
+ - Entrypoints that read or set `libc_errno` should declare
+ **`libc.src.__support.libc_errno`** (for the `src/__support/libc_errno.h`
+ header and inline `Errno` wrapper) and **`libc.src.errno.errno`** (for the
+ compiled runtime storage in `libc_errno.cpp` defining `thread_errno` /
+ `shared_errno` and `__llvm_libc_errno()`).
While LLVM-libc generally disallows dependencies between public entrypoints,
`libc.src.errno.errno` is an **explicitly allowed exception** in the build system
- (see `ALLOWED_DEPS` in `libc/cmake/modules/LLVMLibCObjectRules.cmake`). Downstream
- consumers and test suites that link the entrypoint require this dependency so that
- the storage for `libc_errno` is linked.
+ (see `ALLOWED_DEPS` in `libc/cmake/modules/LLVMLibCObjectRules.cmake`).
4. **CMake Dependencies for Internal Support Libraries:**
- Header-only utility libraries under `libc/src/__support/` (such as `OSUtil` syscall
- wrappers or `FPUtil`) that reference `libc_errno.h` should depend on
- **`libc.src.__support.libc_errno`** so they remain pure header libraries without
- introducing compiled entrypoint object dependencies.
+ Targets under `libc/src/__support/` must **never** depend on
+ `libc.src.errno.errno` (both because `libc/src/__support` is configured
+ before `libc/src/errno` and because header-only `libc/shared/*` and math
+ consumers must not pull in `libc_errno.cpp`). Instead:
+ - Support libraries that only need error constants (`EINVAL`, etc.) must
+ depend on **`libc.hdr.errno_macros`**.
+ - Support libraries that reference `libc_errno` must depend on
+ **`libc.src.__support.libc_errno`**.
5. **Unit and Hermetic Testing:**
- Unit tests verifying functions that set `errno` must use the `ErrnoCheckingTest`
- fixture (`test/UnitTest/ErrnoCheckingTest.h`) and `ErrnoSetterMatcher`
- (`test/UnitTest/ErrnoSetterMatcher.h`).
- - Both `ErrnoCheckingTest` and `ErrnoSetterMatcher` already declare `DEPENDS libc.src.errno.errno`,
- so tests using them inherit the compiled `errno` object transitively.
- - Tests that check `libc_errno` directly without those matchers must declare
- `libc.src.errno.errno` in their test `DEPENDS`.
- - Tests must never `#include <errno.h>`.
+ Unit tests verifying functions that set `errno` should use the
+ `ErrnoCheckingTest` fixture (`test/UnitTest/ErrnoCheckingTest.h`) and
+ `ErrnoSetterMatcher` (`test/UnitTest/ErrnoSetterMatcher.h`).
+ - Test targets created with `add_libc_test`, `add_fp_unittest`,
+ `add_integration_test`, and `add_libc_fuzzer` (as well as
+ `ErrnoCheckingTest` and `ErrnoSetterMatcher`) automatically link
+ `libc.src.errno.errno`.
+ - Tests must never `#include <errno.h>` (except `libc/test/shared/*`, which
+ tests the public header-only `libc/shared/*` interface).
6. **The "Dual-TLS" Pitfall in Overlay Mode:**
Why is strictly adhering to `libc_errno` and `"src/__support/libc_errno.h"` critical?
diff --git a/libc/docs/dev/errno.md b/libc/docs/dev/errno.md
new file mode 100644
index 00000000000000..6c18cfce0068bc
--- /dev/null
+++ b/libc/docs/dev/errno.md
@@ -0,0 +1,191 @@
+(errno)=
+
+# `errno` and `libc_errno` in LLVM-libc
+
+Many C standard library and POSIX functions report errors by setting `errno`.
+Because LLVM-libc supports multiple deployment models—including
+{doc}`../full_host_build`, {doc}`../full_cross_build`, {doc}`../overlay_mode`,
+baremetal targets, GPUs, and header-only consumption via `libc/shared/`—access
+to `errno` inside the library and its test suites is abstracted through
+`libc_errno`.
+
+This guide explains how `libc_errno` is architected, the supported
+`LIBC_ERRNO_MODE` configurations, and the rules for using `libc_errno` in source
+files, build targets, and tests.
+
+## Architecture Overview: Header vs. Runtime Storage
+
+In LLVM-libc, `errno` support is split across three distinct targets:
+
+| CMake Target | Header / Source | Purpose |
+| :--- | :--- | :--- |
+| `libc.hdr.errno_macros` | `libc/hdr/errno_macros.h` | Provides standard error number constants (`EINVAL`, `ERANGE`, `EDOM`, `ENOMEM`, etc.) without declaring `libc_errno`. |
+| `libc.src.__support.libc_errno` | `libc/src/__support/libc_errno.h` | Declares `libc_errno` (either as `#define libc_errno errno` or as `LIBC_INLINE_VAR constexpr Errno libc_errno{}`). |
+| `libc.src.errno.errno` | `libc/src/errno/libc_errno.cpp` | Defines the runtime backing storage (`thread_errno` or `shared_errno`), the public C symbol `extern "C" int *__llvm_libc_errno() noexcept`, and (when `LIBC_COPT_PROVIDE_GNU_ALIASES` is enabled) its Linux/glibc ABI alias `extern "C" int *__errno_location() noexcept`. |
+
+### Why `libc.src.__support.libc_errno` and `libc.src.errno.errno` Are Separated
+
+Keeping the `libc_errno` header library separate from the `libc.src.errno.errno`
+object target is required for five reasons:
+
+1. **Isolating Unit Tests from Host `errno` in Overlay Mode ("Dual-TLS")**:
+ - When building the public overlay archive (`libllvmlibc.a`), entrypoints are
+ compiled with `-DLIBC_COPT_PUBLIC_PACKAGING`, which resolves `libc_errno`
+ to the host system's `<errno.h>` (`LIBC_ERRNO_MODE_SYSTEM_INLINE`).
+ - When building unit tests (`add_libc_test`), entrypoints and tests are
+ compiled *without* `-DLIBC_COPT_PUBLIC_PACKAGING`, which resolves
+ `libc_errno` to LLVM-libc's internal thread-local storage
+ (`LIBC_ERRNO_MODE_THREAD_LOCAL`). This guarantees that running a test never
+ clobbers the host libc's `errno` used by the test harness itself (and vice
+ versa).
+
+2. **Header-Only Shared Libraries (`libc/shared/*`)**:
+ - External LLVM subprojects (such as `libc++` and the offloading runtime)
+ consume internal headers under `libc/src/__support/` via `libc/shared/*.h`.
+ - `libc/shared/libc_common.h` configures `LIBC_ERRNO_MODE_SYSTEM_INLINE` so
+ that `libc_errno` maps directly to `<errno.h>` without compiling or linking
+ `libc_errno.cpp`.
+
+3. **`errno`-Free Math and Vector Math (`FEnvImpl.h`)**:
+ - `libc/src/__support/FPUtil/FEnvImpl.h` includes `src/__support/libc_errno.h`
+ to implement `fputil::set_errno_if_required(int err)`, which guards
+ `libc_errno = err;` behind `if (!cpp::is_constant_evaluated())` and
+ `#ifndef LIBC_MATH_HAS_NO_ERRNO`.
+ - Vector math functions (`libc/src/__support/mathvec/`), builds with
+ `LIBC_MATH_NO_ERRNO` or `LIBC_MATH_FAST`, and scalar math functions that
+ only manipulate floating-point exceptions or rounding modes (`ceil`,
+ `floor`, `trunc`, `round`, `rint`, `copysign`, `frexp`, `modf`, etc.)
+ include `FEnvImpl.h` but emit no link-time reference to
+ `__llvm_libc_errno()`.
+
+4. **Archive Separation (`libc.a` vs. `libm.a` / `libmvec.a`)**:
+ - In full builds, `libc.src.errno.errno` belongs in `libc.a`
+ (`TARGET_LIBC_ENTRYPOINTS`) and must not be packaged into `libm.a` or
+ `libmvec.a`.
+
+5. **Topological Directory Ordering**:
+ - `libc/src/CMakeLists.txt` configures `add_subdirectory(__support)` before
+ `add_subdirectory(errno)` because `libc.src.errno.errno` depends on
+ `libc.src.__support.*`. Targets under `libc/src/__support/` therefore
+ cannot depend on `libc.src.errno.errno`.
+
+## `LIBC_ERRNO_MODE` Configurations
+
+The behavior of `libc_errno` is controlled by the `LIBC_CONF_ERRNO_MODE` CMake
+option (passed to the compiler as `-DLIBC_ERRNO_MODE=<mode>`). In
+`libc/src/__support/libc_errno.h`, `Errno::operator=(int)` and
+`Errno::operator int()` are defined inline (`LIBC_INLINE`), delegating to
+`*__llvm_libc_errno()` when runtime storage is used:
+
+| Mode | `libc_errno` Implementation | Backing Storage (`libc_errno.cpp`) | Typical Use Case |
+| :--- | :--- | :--- | :--- |
+| **`LIBC_ERRNO_MODE_DEFAULT`** | Auto-selects `SYSTEM_INLINE` or `THREAD_LOCAL` (see below). | `thread_errno` (`THREAD_LOCAL`) | Default CMake / Bazel configuration. |
+| **`LIBC_ERRNO_MODE_THREAD_LOCAL`** | `Errno` inline wrapper calling `*__llvm_libc_errno()`. | `LIBC_THREAD_LOCAL int thread_errno;` | Full builds on Linux/macOS/Windows; overlay unit tests. |
+| **`LIBC_ERRNO_MODE_SHARED`** | `Errno` inline wrapper calling `*__llvm_libc_errno()`. | Global `int shared_errno;` | Single-threaded or thread-local-free targets (GPU, UEFI). |
+| **`LIBC_ERRNO_MODE_EXTERNAL`** | `Errno` inline wrapper calling `*__llvm_libc_errno()`. | None (provided by external embedder). | Baremetal targets (`libc/config/baremetal/config.json`). |
+| **`LIBC_ERRNO_MODE_UNDEFINED`** | `Errno` inline no-op (`operator=` does nothing, `operator int()` returns `0`). | None (empty TU). | Minimal embedded environments without `errno`. |
+| **`LIBC_ERRNO_MODE_SYSTEM_INLINE`** | `#define libc_errno errno` (from system `<errno.h>`). | None (empty TU). | Overlay public archive (`libllvmlibc.a`) and `libc/shared/*`. |
+
+### How `LIBC_ERRNO_MODE_DEFAULT` Resolves
+
+When `LIBC_ERRNO_MODE` is unset or set to `LIBC_ERRNO_MODE_DEFAULT`,
+`libc/src/__support/libc_errno.h` resolves it as follows:
+
+- If `LIBC_FULL_BUILD` is defined: resolves to `LIBC_ERRNO_MODE_THREAD_LOCAL`.
+- Otherwise (overlay / non-full build):
+ - If `LIBC_COPT_PUBLIC_PACKAGING` is defined (building `libllvmlibc.a`) **or**
+ `LLVM_LIBC_SHARED_LIBC_COMMON_H` is defined (included after
+ `libc/shared/libc_common.h`): resolves to `LIBC_ERRNO_MODE_SYSTEM_INLINE`.
+ - Otherwise (building unit tests, fuzzers, or benchmarks): resolves to
+ `LIBC_ERRNO_MODE_THREAD_LOCAL`.
+
+## Usage Rules for Contributors
+
+### 1. Header Inclusion in Source and Test Files
+
+- **Never `#include <errno.h>`** in implementation (`libc/src/**`) or test
+ (`libc/test/**`) files.
+- **If you only need error constants (`EINVAL`, `ERANGE`, `EDOM`, `ENOMEM`, etc.)**:
+ Include `"hdr/errno_macros.h"`:
+
+ ```c++
+ #include "hdr/errno_macros.h"
+ ```
+
+- **If you read or write `errno`**:
+ Include `"src/__support/libc_errno.h"` and access `libc_errno`:
+
+ ```c++
+ #include "src/__support/libc_errno.h"
+
+ // Setting errno:
+ libc_errno = EINVAL;
+ ```
+
+ *(Note: `"src/__support/libc_errno.h"` transitively includes
+ `"hdr/errno_macros.h"`, though including `"hdr/errno_macros.h"` explicitly when
+ using error macros is good practice.)*
+
+### 2. Where to Set `libc_errno`
+
+- Set `libc_errno` **only** at the top-level public entrypoint boundary
+ (`LLVM_LIBC_FUNCTION`) just before returning an error value, or via
+ `fputil::set_errno_if_required` in math implementations.
+- Internal helper functions in `libc/src/__support/` should **not** mutate
+ `libc_errno` directly (unless specifically designed as an `errno`-reporting
+ layer). Instead, return `ErrorOr<T>` (`cpp::expected<T, int>`) or
+ `cpp::optional<T>` and convert the error at the entrypoint boundary:
+
+ ```c++
+ LLVM_LIBC_FUNCTION(int, close, (int fd)) {
+ auto res = linux_syscalls::close(fd);
+ if (!res) {
+ libc_errno = res.error();
+ return -1;
+ }
+ return 0;
+ }
+ ```
+
+### 3. CMake `DEPENDS` Rules
+
+Choose the CMake dependency that matches how the target uses `errno`:
+
+1. **Internal Support Libraries (`libc/src/__support/**`)**:
+ - Only uses error constants (`EINVAL`, etc.):
+ `DEPENDS libc.hdr.errno_macros`
+ - Reads or writes `libc_errno`:
+ `DEPENDS libc.src.__support.libc_errno`
+ - **Never** add `libc.src.errno.errno` to a target in `libc/src/__support/**`.
+
+2. **Public Entrypoints (`add_entrypoint_object` under `libc/src/`)**:
+ - Only uses error constants (for example, `pthread_*` functions that return
+ `EINVAL` directly without setting `errno`):
+ `DEPENDS libc.hdr.errno_macros`
+ - Reads or writes `libc_errno`:
+ `DEPENDS libc.src.__support.libc_errno` (and `libc.src.errno.errno` for
+ non-math `libc.a` entrypoints). Note that `libc.src.errno.errno` is the
+ only entrypoint target permitted in another entrypoint's `DEPENDS` list
+ (`ALLOWED_DEPS` in `LLVMLibCObjectRules.cmake`).
+
+3. **Header-Only Shared Tests (`libc/test/shared/*`)**:
+ - Must include `shared/<header>.h` (which includes `shared/libc_common.h`)
+ **before** any internal headers or test headers so that
+ `LLVM_LIBC_SHARED_LIBC_COMMON_H` is defined prior to
+ `src/__support/libc_errno.h`.
+ - When checking `errno` in `libc/test/shared/*`, inspect `errno` directly
+ (since `shared/` uses `LIBC_ERRNO_MODE_SYSTEM_INLINE` in overlay builds and
+ public `<errno.h>` in full builds).
+
+4. **Unit Tests, Integration Tests, Fuzzers, and Performance Tests**:
+ - `add_libc_test`, `add_fp_unittest`, `add_integration_test`,
+ `add_libc_fuzzer`, and `perf_test` automatically link
+ `libc.src.errno.errno`.
+ - Unit tests that verify `errno` behavior should use `ErrnoCheckingTest`
+ (`test/UnitTest/ErrnoCheckingTest.h`) and/or `ErrnoSetterMatcher`
+ (`test/UnitTest/ErrnoSetterMatcher.h`):
+ - `ErrnoCheckingTest` resets `libc_errno = 0` before each `TEST_F` body and
+ asserts that `libc_errno` is `0` at the end of the test (requiring tests
+ that intentionally trigger errors to validate and clear `libc_errno`).
+ - `ErrnoSetterMatcher` (`ASSERT_THAT(..., Fails(EINVAL))` / `Succeeds()`)
+ automatically checks and resets `libc_errno`.
diff --git a/libc/docs/dev/index.md b/libc/docs/dev/index.md
index 25b8102c71059b..fc9711c2ab5cfc 100644
--- a/libc/docs/dev/index.md
+++ b/libc/docs/dev/index.md
@@ -12,6 +12,7 @@ code_style
source_tree_layout
entrypoints
implementing_a_function
+errno
config_options
date_and_time
fuzzing
diff --git a/libc/include/errno.h.def b/libc/include/errno.h.def
index f731accc3b24bf..d08dcfdb14074c 100644
--- a/libc/include/errno.h.def
+++ b/libc/include/errno.h.def
@@ -36,6 +36,7 @@
__BEGIN_C_DECLS
int *__llvm_libc_errno(void) __NOEXCEPT;
+int *__errno_location(void) __NOEXCEPT;
__END_C_DECLS
diff --git a/libc/shared/libc_common.h b/libc/shared/libc_common.h
index 5f7bebdee04b92..60db6b84ba3b7a 100644
--- a/libc/shared/libc_common.h
+++ b/libc/shared/libc_common.h
@@ -10,13 +10,13 @@
#define LLVM_LIBC_SHARED_LIBC_COMMON_H
// Use system errno.
-#ifdef LIBC_ERRNO_MODE
-#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+#ifndef LIBC_ERRNO_MODE
+#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM_INLINE
+#elif defined(LLVM_LIBC_SRC___SUPPORT_LIBC_ERRNO_H) && \
+ !defined(LIBC_FULL_BUILD) && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
#error \
"LIBC_ERRNO_MODE was set to something different from LIBC_ERRNO_MODE_SYSTEM_INLINE."
-#endif // LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
-#else
-#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM_INLINE
#endif // LIBC_ERRNO_MODE
// Use system fenv functions in math implementations.
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index dfb1ed0e13ff39..04748937518eaa 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -7,6 +7,7 @@ add_header_library(
libc_errno.h
DEPENDS
libc.hdr.errno_macros
+ libc.src.__support.macros.attributes
libc.src.__support.macros.config
)
diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index 97b907cb0e5844..530f6b19898c9e 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -9,9 +9,9 @@ add_header_library(
libc.hdr.stdint_proxy
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
+ libc.src.__support.libc_errno
libc.src.__support.macros.attributes
libc.src.__support.macros.properties.cpu_features
- libc.src.errno.errno
libc.src.string.memory_utils.inline_memcpy
)
@@ -25,7 +25,6 @@ add_header_library(
libc.src.__support.macros.attributes
libc.src.__support.macros.properties.architectures
libc.src.__support.macros.sanitizer
- libc.src.errno.errno
)
add_header_library(
@@ -79,10 +78,10 @@ add_header_library(
.fp_bits
.fenv_impl
.rounding_mode
+ libc.hdr.errno_macros
libc.hdr.math_macros
libc.src.__support.CPP.type_traits
libc.src.__support.common
- libc.src.errno.errno
)
add_header_library(
@@ -280,9 +279,9 @@ add_header_library(
.fp_bits
.nearest_integer_operations
.normal_float
+ libc.hdr.errno_macros
libc.hdr.math_macros
libc.hdr.stdint_proxy
- libc.src.errno.errno
libc.src.__support.common
libc.src.__support.CPP.bit
libc.src.__support.CPP.limits
diff --git a/libc/src/__support/FPUtil/ManipulationFunctions.h b/libc/src/__support/FPUtil/ManipulationFunctions.h
index 02dded2f47913c..153274de0cecca 100644
--- a/libc/src/__support/FPUtil/ManipulationFunctions.h
+++ b/libc/src/__support/FPUtil/ManipulationFunctions.h
@@ -16,6 +16,7 @@
#include "dyadic_float.h"
#include "rounding_mode.h"
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN
diff --git a/libc/src/__support/FPUtil/NearestIntegerOperations.h b/libc/src/__support/FPUtil/NearestIntegerOperations.h
index 156a6de255621b..4fc66ab20f7f73 100644
--- a/libc/src/__support/FPUtil/NearestIntegerOperations.h
+++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h
@@ -13,6 +13,7 @@
#include "FPBits.h"
#include "rounding_mode.h"
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
diff --git a/libc/src/__support/File/linux/CMakeLists.txt b/libc/src/__support/File/linux/CMakeLists.txt
index 8ef9e2b761ed4e..be5f0c4d2a1547 100644
--- a/libc/src/__support/File/linux/CMakeLists.txt
+++ b/libc/src/__support/File/linux/CMakeLists.txt
@@ -6,6 +6,7 @@ add_object_library(
HDRS
file.h
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fcntl_macros
libc.hdr.func.free
libc.hdr.stdio_macros
@@ -25,7 +26,6 @@ add_object_library(
libc.src.__support.OSUtil.linux.syscall_wrappers.write
libc.src.__support.error_or
libc.src.__support.File.file
- libc.src.errno.errno
)
add_object_library(
@@ -59,6 +59,5 @@ add_object_library(
libc.src.__support.OSUtil.linux.syscall_wrappers.fcntl
libc.src.__support.OSUtil.linux.syscall_wrappers.statx
libc.src.__support.error_or
- libc.src.errno.errno
libc.src.__support.File.dir
)
diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp
index 0bc3ba37a4a91d..1c0510edbf3fa3 100644
--- a/libc/src/__support/File/linux/file.cpp
+++ b/libc/src/__support/File/linux/file.cpp
@@ -13,6 +13,7 @@
#include "file.h"
#include "file_flags.h"
+#include "hdr/errno_macros.h"
#include "hdr/stdio_macros.h"
#include "hdr/sys_stat_macros.h" // For S_IS*, S_IF*, and S_IR* flags.
#include "hdr/types/off_t.h"
@@ -26,7 +27,6 @@
#include "src/__support/OSUtil/linux/syscall_wrappers/open.h"
#include "src/__support/OSUtil/linux/syscall_wrappers/read.h"
#include "src/__support/OSUtil/linux/syscall_wrappers/write.h"
-#include "src/__support/libc_errno.h" // For error macros
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/__support/OSUtil/linux/CMakeLists.txt b/libc/src/__support/OSUtil/linux/CMakeLists.txt
index 93d24f80ecda8a..94047aa2ed6d9f 100644
--- a/libc/src/__support/OSUtil/linux/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/CMakeLists.txt
@@ -3,6 +3,21 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
endif()
add_subdirectory(${LIBC_TARGET_ARCHITECTURE})
+
+add_header_library(
+ syscall
+ HDRS
+ syscall.h
+ DEPENDS
+ .${LIBC_TARGET_ARCHITECTURE}.linux_${LIBC_TARGET_ARCHITECTURE}_util
+ libc.src.__support.CPP.bit
+ libc.src.__support.common
+ libc.src.__support.error_or
+ libc.src.__support.macros.config
+ libc.src.__support.macros.optimization
+ libc.src.__support.macros.properties.architectures
+)
+
add_subdirectory(syscall_wrappers)
add_subdirectory(stat)
@@ -12,9 +27,8 @@ add_object_library(
exit.cpp
HDRS
io.h
- syscall.h
DEPENDS
- .${LIBC_TARGET_ARCHITECTURE}.linux_${LIBC_TARGET_ARCHITECTURE}_util
+ .syscall
libc.src.__support.common
libc.src.__support.CPP.string_view
libc.include.sys_syscall
diff --git a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
index c7c1f4b9d204f1..338ac586747031 100644
--- a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
@@ -7,7 +7,7 @@ add_header_library(
libc.hdr.types.struct_itimerval
libc.include.sys_syscall
libc.src.__support.OSUtil.linux.syscall_wrappers.setitimer
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -18,7 +18,7 @@ add_header_library(
HDRS
getrandom.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -31,7 +31,7 @@ add_header_library(
HDRS
getpid.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.macros.config
libc.hdr.types.pid_t
@@ -43,7 +43,7 @@ add_header_library(
HDRS
getcpu.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -55,7 +55,7 @@ add_header_library(
HDRS
sched_get_priority_max.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -67,7 +67,7 @@ add_header_library(
HDRS
sched_get_priority_min.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -81,7 +81,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.src.__support.CPP.span
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -95,7 +95,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.hdr.types.struct_sched_param
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -108,7 +108,7 @@ add_header_library(
sched_getscheduler.h
DEPENDS
libc.hdr.types.pid_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -122,7 +122,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.hdr.types.struct_timespec
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -136,7 +136,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.src.__support.CPP.span
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -150,7 +150,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.hdr.types.struct_sched_param
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -164,7 +164,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.hdr.types.struct_sched_param
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -176,7 +176,7 @@ add_header_library(
HDRS
sched_yield.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -188,7 +188,7 @@ add_header_library(
HDRS
close.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -200,10 +200,9 @@ add_header_library(
HDRS
accept.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
- libc.src.__support.libc_errno
libc.src.__support.macros.config
libc.hdr.types.socklen_t
libc.hdr.types.struct_sockaddr
@@ -215,7 +214,7 @@ add_header_library(
HDRS
accept4.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -229,7 +228,7 @@ add_header_library(
HDRS
bind.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -243,7 +242,7 @@ add_header_library(
HDRS
connect.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -257,7 +256,7 @@ add_header_library(
HDRS
getsockopt.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -272,7 +271,7 @@ add_header_library(
DEPENDS
libc.src.__support.common
libc.src.__support.error_or
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.macros.config
libc.hdr.types.socklen_t
libc.hdr.types.struct_sockaddr
@@ -286,7 +285,7 @@ add_header_library(
DEPENDS
libc.src.__support.common
libc.src.__support.error_or
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.macros.config
libc.hdr.types.socklen_t
libc.hdr.types.struct_sockaddr
@@ -298,7 +297,7 @@ add_header_library(
HDRS
listen.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -312,7 +311,7 @@ add_header_library(
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.ssize_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -326,7 +325,7 @@ add_header_library(
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.ssize_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -340,7 +339,7 @@ add_header_library(
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.ssize_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -353,7 +352,7 @@ add_header_library(
fsetxattr.h
DEPENDS
libc.hdr.types.size_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -366,7 +365,7 @@ add_header_library(
setxattr.h
DEPENDS
libc.hdr.types.size_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -379,7 +378,7 @@ add_header_library(
lsetxattr.h
DEPENDS
libc.hdr.types.size_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -391,7 +390,7 @@ add_header_library(
HDRS
flistxattr.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -403,7 +402,7 @@ add_header_library(
HDRS
listxattr.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -415,7 +414,7 @@ add_header_library(
HDRS
llistxattr.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -427,7 +426,7 @@ add_header_library(
HDRS
read.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -440,7 +439,7 @@ add_header_library(
HDRS
recvfrom.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -455,7 +454,7 @@ add_header_library(
HDRS
recvmmsg.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -469,7 +468,7 @@ add_header_library(
HDRS
recvmsg.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -483,7 +482,7 @@ add_header_library(
HDRS
sendmmsg.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -496,7 +495,7 @@ add_header_library(
HDRS
sendmsg.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -510,7 +509,7 @@ add_header_library(
HDRS
sendto.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -527,7 +526,7 @@ add_header_library(
DEPENDS
libc.hdr.types.struct_itimerval
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -542,7 +541,7 @@ add_header_library(
libc.hdr.types.struct_itimerval
libc.include.sys_syscall
libc.src.__support.CPP.limits
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -553,7 +552,7 @@ add_header_library(
HDRS
setsockopt.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -566,7 +565,7 @@ add_header_library(
HDRS
shutdown.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -578,7 +577,7 @@ add_header_library(
HDRS
socket.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -590,7 +589,7 @@ add_header_library(
HDRS
socketpair.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -602,7 +601,7 @@ add_header_library(
HDRS
rt_sigprocmask.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -615,7 +614,7 @@ add_header_library(
HDRS
raise.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.OSUtil.linux.syscall_wrappers.rt_sigprocmask
libc.src.__support.OSUtil.linux.syscall_wrappers.tgkill
libc.src.__support.common
@@ -632,7 +631,7 @@ add_header_library(
HDRS
write.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -645,7 +644,7 @@ add_header_library(
HDRS
open.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -659,7 +658,7 @@ add_header_library(
HDRS
personality.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -671,7 +670,7 @@ add_header_library(
HDRS
pipe2.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -689,7 +688,7 @@ add_header_library(
libc.include.sys_syscall
libc.src.__support.CPP.bit
libc.src.__support.CPP.limits
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -701,7 +700,7 @@ add_header_library(
ptrace.h
DEPENDS
libc.hdr.types.pid_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -713,7 +712,7 @@ add_header_library(
HDRS
utimensat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -726,7 +725,7 @@ add_header_library(
HDRS
memfd_create.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -738,7 +737,7 @@ add_header_library(
HDRS
mmap.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -752,7 +751,7 @@ add_header_library(
HDRS
munmap.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -764,7 +763,7 @@ add_header_library(
HDRS
mprotect.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -776,7 +775,7 @@ add_header_library(
HDRS
pkey_mprotect.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -789,7 +788,7 @@ add_header_library(
HDRS
statx.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -801,7 +800,7 @@ add_header_library(
HDRS
mkdir.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -815,7 +814,7 @@ add_header_library(
HDRS
mkdirat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -828,7 +827,7 @@ add_header_library(
HDRS
mknodat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -842,7 +841,7 @@ add_header_library(
HDRS
chmod.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -856,7 +855,7 @@ add_header_library(
HDRS
fchmod.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -872,7 +871,7 @@ add_header_library(
libc.hdr.errno_macros
libc.hdr.types.mode_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -886,7 +885,7 @@ add_header_library(
libc.hdr.types.gid_t
libc.hdr.types.uid_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -901,7 +900,7 @@ add_header_library(
libc.hdr.types.gid_t
libc.hdr.types.uid_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -912,7 +911,7 @@ add_header_library(
HDRS
ftruncate.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -931,7 +930,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -943,7 +942,7 @@ add_header_library(
libc.include.sys_syscall
libc.src.__support.common
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -956,7 +955,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -969,7 +968,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -982,7 +981,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -995,7 +994,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1008,7 +1007,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1021,7 +1020,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1034,7 +1033,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1048,7 +1047,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1061,7 +1060,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1069,7 +1068,7 @@ add_header_library(
HDRS
link.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1082,7 +1081,7 @@ add_header_library(
HDRS
unlink.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1095,7 +1094,7 @@ add_header_library(
HDRS
unlinkat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1107,7 +1106,7 @@ add_header_library(
HDRS
rmdir.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1120,7 +1119,7 @@ add_header_library(
HDRS
chdir.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1132,7 +1131,7 @@ add_header_library(
HDRS
fchdir.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1144,7 +1143,7 @@ add_header_library(
HDRS
chroot.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1156,7 +1155,7 @@ add_header_library(
HDRS
fcntl.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1174,7 +1173,7 @@ add_header_library(
HDRS
flock.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1186,7 +1185,7 @@ add_header_library(
HDRS
fdatasync.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1198,7 +1197,7 @@ add_header_library(
HDRS
fsync.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1210,7 +1209,7 @@ add_header_library(
HDRS
sync.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.macros.config
libc.include.sys_syscall
@@ -1221,7 +1220,7 @@ add_header_library(
HDRS
syncfs.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1233,7 +1232,7 @@ add_header_library(
HDRS
dup.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1245,7 +1244,7 @@ add_header_library(
HDRS
dup2.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.OSUtil.linux.syscall_wrappers.fcntl
libc.src.__support.common
libc.src.__support.error_or
@@ -1259,7 +1258,7 @@ add_header_library(
HDRS
dup3.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1272,7 +1271,7 @@ add_header_library(
epoll_ctl.h
DEPENDS
libc.hdr.types.struct_epoll_event
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1284,7 +1283,7 @@ add_header_library(
HDRS
access.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1297,7 +1296,7 @@ add_header_library(
HDRS
faccessat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1310,7 +1309,7 @@ add_header_library(
ioctl.h
DEPENDS
libc.src.__support.CPP.type_traits
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.error_or
libc.src.__support.macros.attributes
libc.src.__support.macros.config
@@ -1322,7 +1321,7 @@ add_header_library(
HDRS
readlink.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1336,7 +1335,7 @@ add_header_library(
HDRS
readlinkat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1349,7 +1348,7 @@ add_header_library(
HDRS
rename.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1362,7 +1361,7 @@ add_header_library(
HDRS
renameat.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1374,7 +1373,7 @@ add_header_library(
HDRS
lseek.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1390,7 +1389,7 @@ add_header_library(
DEPENDS
libc.hdr.types.pid_t
libc.hdr.types.struct_rlimit
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1403,7 +1402,7 @@ add_header_library(
sysinfo.h
DEPENDS
libc.hdr.types.struct_sysinfo
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1416,7 +1415,7 @@ add_header_library(
statfs.h
DEPENDS
libc.hdr.types.struct_statfs
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1429,7 +1428,7 @@ add_header_library(
fstatfs.h
DEPENDS
libc.hdr.types.struct_statfs
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1443,7 +1442,7 @@ add_header_library(
DEPENDS
libc.hdr.types.struct_timespec
libc.hdr.time_macros
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1460,7 +1459,7 @@ add_header_library(
libc.hdr.types.sigset_t
libc.hdr.types.struct_pollfd
libc.hdr.types.struct_timespec
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1473,7 +1472,7 @@ add_header_library(
rt_sigaction.h
DEPENDS
libc.hdr.types.sigset_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1508,7 +1507,7 @@ add_header_library(
clone3.h
DEPENDS
libc.hdr.types.pid_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1520,7 +1519,7 @@ add_header_library(
HDRS
execle.h
DEPENDS
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1537,7 +1536,7 @@ add_header_library(
libc.hdr.types.pid_t
libc.hdr.types.siginfo_t
libc.hdr.types.struct_rusage
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1553,7 +1552,7 @@ add_header_library(
libc.hdr.types.idtype_t
libc.hdr.types.siginfo_t
libc.hdr.types.struct_rusage
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1566,7 +1565,7 @@ add_header_library(
execve.h
DEPENDS
libc.hdr.fcntl_macros
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1584,7 +1583,7 @@ add_header_library(
libc.hdr.types.struct_sigevent
libc.hdr.types.timer_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1597,7 +1596,7 @@ add_header_library(
DEPENDS
libc.hdr.types.timer_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1610,7 +1609,7 @@ add_header_library(
DEPENDS
libc.hdr.types.timer_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1624,7 +1623,7 @@ add_header_library(
libc.hdr.types.struct_itimerspec
libc.hdr.types.timer_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1638,7 +1637,7 @@ add_header_library(
libc.hdr.types.struct_itimerspec
libc.hdr.types.timer_t
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1652,7 +1651,7 @@ add_header_library(
libc.hdr.types.clockid_t
libc.hdr.types.struct_timespec
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1664,7 +1663,7 @@ add_header_library(
getrusage.h
DEPENDS
libc.hdr.types.struct_rusage
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1677,7 +1676,7 @@ add_header_library(
getpriority.h
DEPENDS
libc.hdr.types.id_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1690,7 +1689,7 @@ add_header_library(
setpriority.h
DEPENDS
libc.hdr.types.id_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1703,7 +1702,7 @@ add_header_library(
tgkill.h
DEPENDS
libc.hdr.types.pid_t
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1719,7 +1718,7 @@ add_header_library(
libc.include.sys_syscall
libc.src.__support.common
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1729,7 +1728,7 @@ add_header_library(
DEPENDS
libc.src.__support.macros.config
libc.src.__support.common
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.include.sys_syscall
libc.hdr.types.off_t
libc.hdr.errno_macros
@@ -1747,7 +1746,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1761,7 +1760,7 @@ add_header_library(
libc.hdr.types.size_t
libc.hdr.types.struct_timespec
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1773,7 +1772,7 @@ add_header_library(
inotify_init.h
DEPENDS
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1785,7 +1784,7 @@ add_header_library(
inotify_init1.h
DEPENDS
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1798,7 +1797,7 @@ add_header_library(
DEPENDS
libc.hdr.stdint_proxy
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1810,7 +1809,7 @@ add_header_library(
inotify_rm_watch.h
DEPENDS
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
@@ -1845,7 +1844,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
)
add_header_library(
@@ -1854,7 +1853,7 @@ add_header_library(
eventfd.h
DEPENDS
libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.OSUtil.linux.syscall
libc.src.__support.common
libc.src.__support.error_or
libc.src.__support.macros.config
diff --git a/libc/src/__support/StringUtil/tables/CMakeLists.txt b/libc/src/__support/StringUtil/tables/CMakeLists.txt
index 8fe0e36f05f9db..808865e0c6e3aa 100644
--- a/libc/src/__support/StringUtil/tables/CMakeLists.txt
+++ b/libc/src/__support/StringUtil/tables/CMakeLists.txt
@@ -12,7 +12,7 @@ add_header_library(
HDRS
posix_errors.h
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.__support.StringUtil.message_mapper
)
@@ -21,8 +21,8 @@ add_header_library(
HDRS
linux_extension_errors.h
DEPENDS
+ libc.hdr.errno_macros
libc.src.__support.StringUtil.message_mapper
- libc.src.errno.errno
)
add_header_library(
diff --git a/libc/src/__support/StringUtil/tables/linux_extension_errors.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h
index de637d60bea974..e0f49c66691e3a 100644
--- a/libc/src/__support/StringUtil/tables/linux_extension_errors.h
+++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_LINUX_EXTENSION_ERRORS_H
#define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_LINUX_EXTENSION_ERRORS_H
+#include "hdr/errno_macros.h"
#include "src/__support/StringUtil/message_mapper.h"
-#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/__support/libc_errno.h b/libc/src/__support/libc_errno.h
index 3720cdebd5d2ae..02a9330a4965e9 100644
--- a/libc/src/__support/libc_errno.h
+++ b/libc/src/__support/libc_errno.h
@@ -46,13 +46,20 @@
#if !defined(LIBC_ERRNO_MODE) || LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_DEFAULT
#undef LIBC_ERRNO_MODE
-#if defined(LIBC_FULL_BUILD) || !defined(LIBC_COPT_PUBLIC_PACKAGING)
+#if defined(LIBC_FULL_BUILD) || (!defined(LIBC_COPT_PUBLIC_PACKAGING) && \
+ !defined(LLVM_LIBC_SHARED_LIBC_COMMON_H))
#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_THREAD_LOCAL
#else
#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM_INLINE
#endif
#endif // LIBC_ERRNO_MODE
+#if defined(LLVM_LIBC_SHARED_LIBC_COMMON_H) && !defined(LIBC_FULL_BUILD) && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+#error \
+ "LIBC_ERRNO_MODE was set to something different from LIBC_ERRNO_MODE_SYSTEM_INLINE."
+#endif
+
#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_DEFAULT && \
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_UNDEFINED && \
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_THREAD_LOCAL && \
@@ -77,6 +84,7 @@ LIBC_ERRNO_MODE_SYSTEM_INLINE.
#else // !LIBC_ERRNO_MODE_SYSTEM_INLINE
#include "hdr/errno_macros.h"
+#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
@@ -84,11 +92,18 @@ namespace LIBC_NAMESPACE_DECL {
extern "C" int *__llvm_libc_errno() noexcept;
struct Errno {
- void operator=(int);
- operator int();
+#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_UNDEFINED
+ LIBC_INLINE constexpr void operator=(int) const noexcept {}
+ LIBC_INLINE constexpr operator int() const noexcept { return 0; }
+ LIBC_INLINE constexpr int *operator&() const noexcept { return nullptr; }
+#else
+ LIBC_INLINE void operator=(int a) const noexcept { *__llvm_libc_errno() = a; }
+ LIBC_INLINE operator int() const noexcept { return *__llvm_libc_errno(); }
+ LIBC_INLINE int *operator&() const noexcept { return __llvm_libc_errno(); }
+#endif
};
-extern Errno libc_errno;
+LIBC_INLINE_VAR constexpr Errno libc_errno{};
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index c0751d7e15f102..231e86721f1d48 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -2814,7 +2814,6 @@ add_header_library(
cos.h
DEPENDS
libc.hdr.errno_macros
- libc.src.errno.errno
libc.src.__support.FPUtil.double_double
libc.src.__support.FPUtil.dyadic_float
libc.src.__support.FPUtil.except_value_utils
@@ -3024,7 +3023,7 @@ add_header_library(
exp10m1f.h
DEPENDS
.exp10f_utils
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.__support.common
libc.src.__support.FPUtil.except_value_utils
libc.src.__support.FPUtil.fenv_impl
@@ -4449,7 +4448,7 @@ add_header_library(
exp2m1f.h
DEPENDS
.exp10f_utils
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.__support.common
libc.src.__support.FPUtil.except_value_utils
libc.src.__support.FPUtil.fenv_impl
@@ -4600,6 +4599,7 @@ add_header_library(
DEPENDS
.common_constants
.exp_constants
+ libc.hdr.errno_macros
libc.src.__support.CPP.bit
libc.src.__support.FPUtil.dyadic_float
libc.src.__support.FPUtil.fenv_impl
@@ -4610,7 +4610,6 @@ add_header_library(
libc.src.__support.FPUtil.triple_double
libc.src.__support.integer_literals
libc.src.__support.macros.optimization
- libc.src.errno.errno
)
add_header_library(
@@ -4619,6 +4618,7 @@ add_header_library(
expm1f.h
DEPENDS
.common_constants
+ libc.hdr.errno_macros
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.fenv_impl
libc.src.__support.FPUtil.fp_bits
@@ -4627,7 +4627,6 @@ add_header_library(
libc.src.__support.FPUtil.polyeval
libc.src.__support.FPUtil.rounding_mode
libc.src.__support.macros.optimization
- libc.src.errno.errno
)
add_header_library(
@@ -5663,7 +5662,6 @@ add_header_library(
sin.h
DEPENDS
libc.hdr.errno_macros
- libc.src.errno.errno
libc.src.__support.FPUtil.double_double
libc.src.__support.FPUtil.dyadic_float
libc.src.__support.FPUtil.fenv_impl
diff --git a/libc/src/__support/math/cos.h b/libc/src/__support/math/cos.h
index bd63d8d5d87cfc..df69c8e292b306 100644
--- a/libc/src/__support/math/cos.h
+++ b/libc/src/__support/math/cos.h
@@ -14,6 +14,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_COS_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_COS_H
+#include "hdr/errno_macros.h"
#include "range_reduction_double_common.h"
#include "sincos_eval.h"
#include "src/__support/FPUtil/FEnvImpl.h"
diff --git a/libc/src/__support/math/exp10m1f.h b/libc/src/__support/math/exp10m1f.h
index 6aef47b7fae1eb..ef6e5fdf927236 100644
--- a/libc/src/__support/math/exp10m1f.h
+++ b/libc/src/__support/math/exp10m1f.h
@@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXP10M1F_H
#include "exp10f_utils.h"
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
@@ -17,7 +18,6 @@
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/common.h"
-#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
diff --git a/libc/src/__support/math/exp2m1f.h b/libc/src/__support/math/exp2m1f.h
index 80db977f2f2b8e..51ed575d879811 100644
--- a/libc/src/__support/math/exp2m1f.h
+++ b/libc/src/__support/math/exp2m1f.h
@@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXP2M1F_H
#include "exp10f_utils.h"
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
@@ -17,7 +18,6 @@
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/common.h"
-#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/macros/properties/cpu_features.h"
diff --git a/libc/src/__support/math/expm1.h b/libc/src/__support/math/expm1.h
index a357699cbed99e..e30953ee5d97f3 100644
--- a/libc/src/__support/math/expm1.h
+++ b/libc/src/__support/math/expm1.h
@@ -11,6 +11,7 @@
#include "common_constants.h" // Lookup tables EXP_M1 and EXP_M2.
#include "exp_constants.h"
+#include "hdr/errno_macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
diff --git a/libc/src/__support/math/expm1f.h b/libc/src/__support/math/expm1f.h
index 436fb1ca4e876d..e61e72d36209a9 100644
--- a/libc/src/__support/math/expm1f.h
+++ b/libc/src/__support/math/expm1f.h
@@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXPM1F_H
#include "common_constants.h" // Lookup tables EXP_M1 and EXP_M2.
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FMA.h"
diff --git a/libc/src/__support/math/sin.h b/libc/src/__support/math/sin.h
index 5038ed55fb006d..4ae04ae64a423d 100644
--- a/libc/src/__support/math/sin.h
+++ b/libc/src/__support/math/sin.h
@@ -14,6 +14,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_SIN_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_SIN_H
+#include "hdr/errno_macros.h"
#include "range_reduction_double_common.h"
#include "sincos_eval.h"
#include "src/__support/FPUtil/FEnvImpl.h"
diff --git a/libc/src/__support/printf_core/CMakeLists.txt b/libc/src/__support/printf_core/CMakeLists.txt
index d059d8881c4141..961152fff2bba7 100644
--- a/libc/src/__support/printf_core/CMakeLists.txt
+++ b/libc/src/__support/printf_core/CMakeLists.txt
@@ -111,6 +111,7 @@ add_header_library(
.core_structs
libc.src.__support.arg_list
libc.src.__support.ctype_utils
+ libc.src.__support.libc_errno
libc.src.__support.str_to_integer
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.bit
diff --git a/libc/src/__support/threads/linux/CMakeLists.txt b/libc/src/__support/threads/linux/CMakeLists.txt
index 2e539d4895835b..ea5ec01b032e70 100644
--- a/libc/src/__support/threads/linux/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/CMakeLists.txt
@@ -67,7 +67,6 @@ add_object_library(
libc.hdr.errno_macros
libc.hdr.sched_macros
libc.hdr.sys_mman_macros
- libc.src.errno.errno
libc.src.__support.CPP.atomic
libc.src.__support.CPP.stringstream
libc.src.__support.CPP.string_view
diff --git a/libc/src/__support/threads/linux/thread.cpp b/libc/src/__support/threads/linux/thread.cpp
index db8f7ed103c778..ce38259d38bf5b 100644
--- a/libc/src/__support/threads/linux/thread.cpp
+++ b/libc/src/__support/threads/linux/thread.cpp
@@ -34,7 +34,6 @@
#include "src/__support/OSUtil/syscall.h" // For syscall functions.
#include "src/__support/common.h"
#include "src/__support/error_or.h"
-#include "src/__support/libc_errno.h" // For error macros
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/futex_utils.h" // For FutexWordType
#include "src/__support/threads/linux/futex_word.h"
diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp
index e8960fcd89500f..77288e493a3c0e 100644
--- a/libc/src/errno/libc_errno.cpp
+++ b/libc/src/errno/libc_errno.cpp
@@ -7,19 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/__support/libc_errno.h"
+#include "src/__support/common.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
-
-#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_UNDEFINED
-
-void Errno::operator=(int) {}
-Errno::operator int() { return 0; }
-
-#elif LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_THREAD_LOCAL
+#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_THREAD_LOCAL
namespace {
LIBC_THREAD_LOCAL int thread_errno;
@@ -27,9 +21,6 @@ LIBC_THREAD_LOCAL int thread_errno;
extern "C" int *__llvm_libc_errno() noexcept { return &thread_errno; }
-void Errno::operator=(int a) { thread_errno = a; }
-Errno::operator int() { return thread_errno; }
-
#elif LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_SHARED
namespace {
@@ -38,19 +29,12 @@ int shared_errno;
extern "C" int *__llvm_libc_errno() noexcept { return &shared_errno; }
-void Errno::operator=(int a) { shared_errno = a; }
-Errno::operator int() { return shared_errno; }
-
-#elif LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_EXTERNAL
-
-void Errno::operator=(int a) { *__llvm_libc_errno() = a; }
-Errno::operator int() { return *__llvm_libc_errno(); }
-
#endif
-// Define the global `libc_errno` instance.
-Errno libc_errno;
-
-#endif // LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
-
} // namespace LIBC_NAMESPACE_DECL
+
+#if defined(LIBC_COPT_PROVIDE_GNU_ALIASES) && \
+ (LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_THREAD_LOCAL || \
+ LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_SHARED)
+LLVM_LIBC_ADD_FUNCTION_C_ALIAS(__llvm_libc_errno, __errno_location);
+#endif
diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 4a5cbd8040b52d..3d9cb6d2cbf1e0 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -141,9 +141,6 @@ void *calloc(size_t num, size_t size) {
LIBC_NAMESPACE::memset(mem, 0, total);
return mem;
}
-#if defined(__linux__)
-int *__errno_location() noexcept { return LIBC_NAMESPACE::__llvm_libc_errno(); }
-#endif
} // extern "C"
diff --git a/libc/test/src/errno/CMakeLists.txt b/libc/test/src/errno/CMakeLists.txt
index b5e63e912c3300..192712ab70b50a 100644
--- a/libc/test/src/errno/CMakeLists.txt
+++ b/libc/test/src/errno/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(NOT LLVM_LIBC_FULL_BUILD OR LIBC_TARGET_OS_IS_GPU)
+if(LIBC_TARGET_OS_IS_GPU)
return()
endif()
diff --git a/libc/test/src/errno/errno_test.cpp b/libc/test/src/errno/errno_test.cpp
index 32fb3ec7640630..e056e883a2860a 100644
--- a/libc/test/src/errno/errno_test.cpp
+++ b/libc/test/src/errno/errno_test.cpp
@@ -13,5 +13,10 @@
TEST(LlvmLibcErrnoTest, Basic) {
int test_val = 123;
libc_errno = test_val;
+#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_UNDEFINED && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+ EXPECT_EQ(&libc_errno, LIBC_NAMESPACE::__llvm_libc_errno());
+ EXPECT_EQ(*LIBC_NAMESPACE::__llvm_libc_errno(), test_val);
+#endif
ASSERT_ERRNO_EQ(test_val);
}
diff --git a/libc/test/src/math/performance_testing/CMakeLists.txt b/libc/test/src/math/performance_testing/CMakeLists.txt
index 2053c68d5a4a41..9669c579d0e6cb 100644
--- a/libc/test/src/math/performance_testing/CMakeLists.txt
+++ b/libc/test/src/math/performance_testing/CMakeLists.txt
@@ -98,6 +98,7 @@ add_header_library(
DEPENDS
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
+ libc.src.errno.errno
)
add_perf_binary(
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 210e2e1eb4a09a..05aedac2dbc454 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -5160,6 +5160,7 @@ libc_support_library(
name = "__support_libc_errno",
hdrs = ["src/__support/libc_errno.h"],
deps = [
+ ":__support_macros_attributes",
":__support_macros_config",
":hdr_errno_macros",
],
>From 53c9a234bcea5ce7dabfad0efb8cf66aaa15677d Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Mon, 26 Oct 2026 03:23:04 +0000
Subject: [PATCH 2/2] Fix Bazel build dependencies and config options.
Assisted-by: Gemini
---
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 12 +++++++++---
.../libc/libc_configure_options.bzl | 3 +++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 05aedac2dbc454..b9189d72063695 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2392,7 +2392,6 @@ libc_support_library(
":__support_cpp_type_traits",
":__support_error_or",
":__support_file_file",
- ":__support_libc_errno",
":__support_macros_attributes",
":__support_macros_config",
":__support_osutil_linux_syscall_wrappers_close",
@@ -2403,6 +2402,7 @@ libc_support_library(
":__support_osutil_linux_syscall_wrappers_read",
":__support_osutil_linux_syscall_wrappers_write",
":func_free",
+ ":hdr_errno_macros",
":hdr_fcntl_macros",
":hdr_stdint_proxy",
":hdr_stdio_macros",
@@ -3528,6 +3528,7 @@ libc_support_library(
":__support_macros_optimization",
":__support_macros_properties_architectures",
":__support_uint128",
+ ":hdr_errno_macros",
":hdr_math_macros",
":hdr_stdint_proxy",
],
@@ -3544,6 +3545,7 @@ libc_support_library(
":__support_fputil_rounding_mode",
":__support_macros_attributes",
":__support_macros_config",
+ ":hdr_errno_macros",
":hdr_math_macros",
],
)
@@ -8665,6 +8667,7 @@ libc_support_library(
":__support_macros_properties_cpu_features",
":__support_range_reduction_double",
":__support_sincos_eval",
+ ":hdr_errno_macros",
],
)
@@ -8861,10 +8864,10 @@ libc_support_library(
":__support_fputil_multiply_add",
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
- ":__support_libc_errno",
":__support_macros_config",
":__support_macros_optimization",
":__support_math_exp10f_utils",
+ ":hdr_errno_macros",
],
)
@@ -10926,12 +10929,12 @@ libc_support_library(
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
- ":__support_libc_errno",
":__support_macros_config",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":__support_math_common_constants",
":__support_math_exp10f_utils",
+ ":hdr_errno_macros",
],
)
@@ -11102,6 +11105,7 @@ libc_support_library(
":__support_macros_optimization",
":__support_math_common_constants",
":__support_math_exp_constants",
+ ":hdr_errno_macros",
],
)
@@ -11122,6 +11126,7 @@ libc_support_library(
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":__support_math_common_constants",
+ ":hdr_errno_macros",
],
)
@@ -11365,6 +11370,7 @@ libc_support_library(
":__support_macros_properties_cpu_features",
":__support_range_reduction_double",
":__support_sincos_eval",
+ ":hdr_errno_macros",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
index 9626f49c6e1591..c4081b317bc32b 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
@@ -67,6 +67,9 @@ LIBC_CONFIGURE_FULL_BUILD_OPTIONS = [
# Documentation in libc/src/__support/libc_errno.h
"LIBC_ERRNO_MODE=LIBC_ERRNO_MODE_THREAD_LOCAL",
+ # Provide GNU-compatible aliases (e.g. __errno_location).
+ "LIBC_COPT_PROVIDE_GNU_ALIASES",
+
# Defined for targets which support threads.
"LIBC_COPT_SUPPORT_THREADS",
]
More information about the libc-commits
mailing list