Skip to content

Conversation

vonosmas
Copy link
Contributor

Bazel only supports overlay build currently, so there's always system libc (and system errno_ present. Use the new
LIBC_ERRNO_MODE_SYSTEM_INLINE by default, instead of using thread-local one in the unit tests and system errno for "public packaging" (i.e. prod build). This way, we can ensure that we're testing the same configuration as the one that will be used in production.

This is the second attempt to do that after f9146cc was reverted in 279e82f. Since then, many tests have been migrated to ErrnoCheckingTest so the change should be safe even for those downstream customers that clobber system errno value before unit tests are being called.

Bazel only supports overlay build currently, so there's always system
libc (and system errno_ present. Use the new
LIBC_ERRNO_MODE_SYSTEM_INLINE by default, instead of using thread-local
one in the unit tests and system errno for "public packaging" (i.e. prod
build). This way, we can ensure that we're testing the same
configuration as the one that will be used in production.

This is the second attempt to do that after f9146cc was reverted in
279e82f. Since then, many tests have been migrated to ErrnoCheckingTest
so the change should be safe even for those downstream customers that
clobber system errno value before unit tests are being called.
@vonosmas vonosmas requested a review from lntue August 11, 2025 00:21
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Aug 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 11, 2025

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

Changes

Bazel only supports overlay build currently, so there's always system libc (and system errno_ present. Use the new
LIBC_ERRNO_MODE_SYSTEM_INLINE by default, instead of using thread-local one in the unit tests and system errno for "public packaging" (i.e. prod build). This way, we can ensure that we're testing the same configuration as the one that will be used in production.

This is the second attempt to do that after f9146cc was reverted in 279e82f. Since then, many tests have been migrated to ErrnoCheckingTest so the change should be safe even for those downstream customers that clobber system errno value before unit tests are being called.


Full diff: https://github.com/llvm/llvm-project/pull/152946.diff

1 Files Affected:

  • (modified) utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl (+3)
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 b49e7c3fad954..179fc83e67298 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
@@ -49,4 +49,7 @@ LIBC_CONFIGURE_OPTIONS = [
 
     # Documentation in libc/docs/configure.rst
     "LIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM",
+
+    # Documentation in libc/src/__support/libc_errno.h
+    "LIBC_ERRNO_MODE=LIBC_ERRNO_MODE_SYSTEM_INLINE",
 ]

@vonosmas vonosmas merged commit 5ccc734 into llvm:main Aug 11, 2025
12 checks passed
@vonosmas vonosmas deleted the libc-errno-system-inline branch August 11, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants