-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc][bazel] Convert "errno" to libc_support_library. #130368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This shouldn't really be a "libc_function" since it can be used as a dependency of various other support libraries and functions, and doesn't correspond to a well-defined endpoint that the users may want to explicitly depend on (if they depend on it implicitly through a libc_function whose implementation relies on errno, the dependency will be pulled in normally). Remove special handling for "errno" in the Bazel test rules.
|
@llvm/pr-subscribers-libc Author: Alexey Samsonov (vonosmas) ChangesThis shouldn't really be a "libc_function" since it can be used as a dependency of various other support libraries and functions, and doesn't correspond to a well-defined endpoint that the users may want to explicitly depend on (if they depend on it implicitly through a libc_function whose implementation relies on errno, the dependency will be pulled in normally). Remove special handling for "errno" in the Bazel test rules. Full diff: https://github.com/llvm/llvm-project/pull/130368.diff 3 Files Affected:
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 61de1aa7f2abe..757db65ca8a77 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1598,9 +1598,9 @@ libc_support_library(
],
)
-############################### errno targets ################################
+############################### errno ########################################
-libc_function(
+libc_support_library(
name = "errno",
srcs = ["src/errno/libc_errno.cpp"],
hdrs = ["src/errno/libc_errno.h"],
diff --git a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
index 23dc1afec9e42..8c20a9172989c 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
@@ -27,14 +27,14 @@ def libc_test(name, srcs, libc_function_deps = [], copts = [], deps = [], local_
local_defines: The list of target local_defines if any.
**kwargs: Attributes relevant for a libc_test. For example, name, srcs.
"""
- all_function_deps = libc_function_deps + ["//libc:errno"]
native.cc_test(
name = name,
srcs = srcs,
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
- deps = [libc_internal_target(d) for d in all_function_deps] + [
+ deps = [libc_internal_target(d) for d in libc_function_deps] + [
"//libc/test/UnitTest:LibcUnitTest",
"//libc:__support_macros_config",
+ "//libc:errno",
"//libc:func_aligned_alloc",
"//libc:func_free",
"//libc:func_malloc",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel
index abe5e69fae926..5f43ec7c7a109 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel
@@ -186,7 +186,7 @@ libc_test_library(
"//libc:__support_cpp_type_traits",
"//libc:__support_ctype_utils",
"//libc:__support_macros_properties_architectures",
- "//libc:errno.__internal__",
+ "//libc:errno",
"//libc/test/UnitTest:LibcUnitTest",
],
)
|
|
Currently, bazel build is essentially in overlay mode. So I think we should define |
I believe this is orthogonal to the PR, since the PR only changes the bazel plumbing, but doesn't modify how the library is used in any meaningful way? In any case, I looked at libc/src/errno/libc_errno.cpp , and it seems that:
|
Yes, the reason I asked was before it looks like this PR will silently change the errno config for unit tests, so if it's still working then probably we should explicitly set that flag in case it is changed in the future. |
and a separate patch is totally fine for me. |
This PR doesn't change the errno config for unit tests - the tests used to depend on |
Thanks! I'll land this PR after an LGTM, and will send a follow-up CL to explicitly depend on system errno in llvm-libc Bazel build. |
…130663) Addressing the comments from PR #130368 review. Since Bazel builds are effectively overlay mode, switch to explicitly setting -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_SYSTEM configuration option, so that unit tests and release builds are consistent. Verified that all the unit tests pass with this flag specified.
This shouldn't really be a "libc_function" since it can be used as a dependency of various other support libraries and functions, and doesn't correspond to a well-defined endpoint that the users may want to explicitly depend on (if they depend on it implicitly through a libc_function whose implementation relies on errno, the dependency will be pulled in normally). Remove special handling for "errno" in the Bazel test rules.