[llvm] [libc][bazel] Set LIBC_ERRNO_MODE_SYSTEM_INLINE by default. (PR #152946)

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 10 17:21:54 PDT 2025


https://github.com/vonosmas created https://github.com/llvm/llvm-project/pull/152946

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.

>From 44c2fad4c1212a7b3f239b76cd4312512a9ded59 Mon Sep 17 00:00:00 2001
From: Alexey Samsonov <vonosmas at gmail.com>
Date: Sun, 10 Aug 2025 17:13:44 -0700
Subject: [PATCH] [libc][bazel] Set LIBC_ERRNO_MODE_SYSTEM_INLINE by default.

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/llvm-project-overlay/libc/libc_configure_options.bzl | 3 +++
 1 file changed, 3 insertions(+)

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",
 ]



More information about the llvm-commits mailing list